Computer Webmaster Gaming Console Graphics Forum

Welcome to the Computer Webmaster Gaming Console Graphics Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

MK PitStop Main Earn $25 Earn Money Posting Extras Members Blogs Image Hosting User Pages
Go Back   Computer Webmaster Gaming Console Graphics Forum > Webmaster Forum > Website Coding > PHP
Register FAQ/Rules Become A V.I.P. Member Search Today's Posts Mark Forums Read

PHP PHP for some can be one of the hardest website programming codes, so do you need help on your PHP script, if it is php4, php5 or lower this is the place for you for any PHP help.

Google
Closed Thread
 
LinkBack Thread Tools Display Modes
Old 05-20-2007, 6:33 PM   #1
Art
 
Art's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default help with posting using conditional if

Can anyone help. I've tried scaling down a script to the bare minimum and
it still is not working correctly. What I think should happen is that when
the field app_fname is blank, that $hold_chk will get set to 1 and the 1st
if statement will be executed. What actually happens is that when I hit
submit, the form stays where it is, for example if the form where the submit
button is located is on the form other.php, then when I hit submit this is
where it stays. If I then hit the submit button a 2nd time, it post to the
some.php form. I've tried this script without the conditional if(isset()
and it works. I need to have the isset() otherwise the form displays all
empty fields as soon as it loads, before the submit button is hit. Any help
would be appreciated. After working on this for 2 weeks it seems like i'm
stuck.

Thanks
Art

<?php

$holdchk = 0;

if (isset($_POST['B1'])) {

echo "<br><br><br>";
if (empty($_POST['app_fname'])) {
$holdchk = 1;
}

if ($holdchk == 1 ){
echo "<form method=\"POST\" action=\"some.php\">";

}

if ($holdchk == 0 ){
echo "<form method=\"POST\" action=\"other.php\">";

}
}
?>

<html>

<head>
</head>

<form method="POST" action="">

When
hit the submit button</font></b> <input
type="submit" value="Submit" name="B1"></p>
</form>
</body>

</html>



 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Advertisements
Old 05-20-2007, 6:33 PM   #2
Vince Morgan
 
Vince Morgan's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default help with posting using conditional if


"Art" <c_art@bellsouth.net> wrote in message
news:QxF_h.45453$254.40238@bignews7.bellsouth.net. ..
> Can anyone help. I've tried scaling down a script to the bare minimum and
> it still is not working correctly. What I think should happen is that

when
> the field app_fname is blank, that $hold_chk will get set to 1 and the 1st
> if statement will be executed. What actually happens is that when I hit
> submit, the form stays where it is, for example if the form where the

submit
> button is located is on the form other.php, then when I hit submit this is
> where it stays. If I then hit the submit button a 2nd time, it post to

the
> some.php form. I've tried this script without the conditional if(isset()
> and it works. I need to have the isset() otherwise the form displays all
> empty fields as soon as it loads, before the submit button is hit. Any

help
> would be appreciated. After working on this for 2 weeks it seems like i'm
> stuck.
>
> Thanks
> Art
>
> <?php
>
> $holdchk = 0;
>
> if (isset($_POST['B1'])) {
>
> echo "<br><br><br>";
> if (empty($_POST['app_fname'])) {
> $holdchk = 1;
> }
>


You don't realy need $holdchk as I see it. You can set the form name
instead.

<?php
if (isset($_POST['B1'])) {
echo "<br><br><br>";
if (empty($_POST['app_fname'])) {
$form='some.php';
}else{
$form='other.php';
}
}
?>
<html>
<head>
</head>

<form method="POST" action="<?php $form ?>">

When hit the submit button </font></b><input
type="submit" value="Submit" name="B1"></p>
</form>
</body>
</html>

HTH
Vince


 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 05-20-2007, 6:33 PM   #3
Vince Morgan
 
Vince Morgan's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default help with posting using conditional if

"Vince Morgan" <vinharAtHereoptusnet.com.au> wrote in message
news:463b2886$0$10157$afc38c87@news.optusnet.com.a u...
>
> "Art" <c_art@bellsouth.net> wrote in message
> news:QxF_h.45453$254.40238@bignews7.bellsouth.net. ..
> > Can anyone help. I've tried scaling down a script to the bare minimum

and
> > it still is not working correctly. What I think should happen is that

> when
> > the field app_fname is blank, that $hold_chk will get set to 1 and the

1st
> > if statement will be executed. What actually happens is that when I hit
> > submit, the form stays where it is, for example if the form where the

> submit
> > button is located is on the form other.php, then when I hit submit this

is
> > where it stays. If I then hit the submit button a 2nd time, it post to

> the
> > some.php form. I've tried this script without the conditional

if(isset()
> > and it works. I need to have the isset() otherwise the form displays

all
> > empty fields as soon as it loads, before the submit button is hit. Any

> help
> > would be appreciated. After working on this for 2 weeks it seems like

i'm
> > stuck.
> >
> > Thanks
> > Art
> >
> > <?php
> >
> > $holdchk = 0;
> >
> > if (isset($_POST['B1'])) {
> >
> > echo "<br><br><br>";
> > if (empty($_POST['app_fname'])) {
> > $holdchk = 1;
> > }
> >

>
> You don't realy need $holdchk as I see it. You can set the form name
> instead.
>

First time through I've realized $form will be unset and there is not
default form, and as your first if statement doesn't offer an else that will
always be the case.
You need a form name to post to on the first run, and I would suggest in
this case posting back to itself for the sake of the exercise. You haven't
included the code that detirmines why "some.php" in one case and "other.php"
in an other, though I'm sure you know the reasons.
Perhaps you should set the $form var to the name of the first form you need
to call when $_POST['B1'])) is *not* set.
Or, just call the form itself as below on the first post.

Ie;
<?php
$form = $_SERVER['PHP_SELF'];
if (isset($_POST['B1'])) {
echo "<br><br><br>";
if (empty($_POST['app_fname'])) {
$form='some.php';
}else{
$form='other.php';
}
}
?>
<html>
etc.
HTH
Vince


 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 05-20-2007, 6:33 PM   #4
Art
 
Art's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default help with posting using conditional if

Thanks Vince, the problem i'm having is that there are multiple fields that
are being checked. I wanted to scale down the problem so I just showed one
field. When each field is checked, the value in $hold_chk is set to 1 if
it's blank. When the script gets to the "if" statement, it checks that
condition to determine if ANY of the fields were blank and echo's this back
to the user.

The form other.php is the original form and the form some.php is the form I
want it to go to when all required fields have been filled in.

Thanks
Art

"Vince Morgan" <vinharAtHereoptusnet.com.au> wrote in message
news:463b2c03$0$30103$afc38c87@news.optusnet.com.a u...
> "Vince Morgan" <vinharAtHereoptusnet.com.au> wrote in message
> news:463b2886$0$10157$afc38c87@news.optusnet.com.a u...
>>
>> "Art" <c_art@bellsouth.net> wrote in message
>> news:QxF_h.45453$254.40238@bignews7.bellsouth.net. ..
>> > Can anyone help. I've tried scaling down a script to the bare minimum

> and
>> > it still is not working correctly. What I think should happen is that

>> when
>> > the field app_fname is blank, that $hold_chk will get set to 1 and the

> 1st
>> > if statement will be executed. What actually happens is that when I
>> > hit
>> > submit, the form stays where it is, for example if the form where the

>> submit
>> > button is located is on the form other.php, then when I hit submit this

> is
>> > where it stays. If I then hit the submit button a 2nd time, it post to

>> the
>> > some.php form. I've tried this script without the conditional

> if(isset()
>> > and it works. I need to have the isset() otherwise the form displays

> all
>> > empty fields as soon as it loads, before the submit button is hit. Any

>> help
>> > would be appreciated. After working on this for 2 weeks it seems like

> i'm
>> > stuck.
>> >
>> > Thanks
>> > Art
>> >
>> > <?php
>> >
>> > $holdchk = 0;
>> >
>> > if (isset($_POST['B1'])) {
>> >
>> > echo "<br><br><br>";
>> > if (empty($_POST['app_fname'])) {
>> > $holdchk = 1;
>> > }
>> >

>>
>> You don't realy need $holdchk as I see it. You can set the form name
>> instead.
>>

> First time through I've realized $form will be unset and there is not
> default form, and as your first if statement doesn't offer an else that
> will
> always be the case.
> You need a form name to post to on the first run, and I would suggest in
> this case posting back to itself for the sake of the exercise. You
> haven't
> included the code that detirmines why "some.php" in one case and
> "other.php"
> in an other, though I'm sure you know the reasons.
> Perhaps you should set the $form var to the name of the first form you
> need
> to call when $_POST['B1'])) is *not* set.
> Or, just call the form itself as below on the first post.
>
> Ie;
> <?php
> $form = $_SERVER['PHP_SELF'];
> if (isset($_POST['B1'])) {
> echo "<br><br><br>";
> if (empty($_POST['app_fname'])) {
> $form='some.php';
> }else{
> $form='other.php';
> }
> }
> ?>
> <html>
> etc.
> HTH
> Vince
>
>



 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Featured Websites
Free Space
Free Space
Free Space Free Space
Closed Thread
Tags: , , ,




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Posting Contest: Win $50 for maximum posts. Mark07 Market Place 1 04-18-2007 5:24 PM
Please READ before posting MadKad The Games 0 10-19-2006 11:20 PM
Please READ before posting MadKad Website review 0 07-25-2006 3:58 PM
Cheapest Forum Posting Service mayank Anything For Sale 6 04-03-2006 11:12 AM


Featured Websites




All times are GMT +1. The time now is 12:04 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0
Cheap Computers
MK PitStop Copyright 2005 - 2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98