Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
php forms
Name: studix Date: June 8, 2005 at 07:58:12 Pacific OS: xp CPU/Ram: pentium M 512mb
Comment:
HI there, im begining to learn php. Im a total beginer, so please excuse the easy questions. ive got a simple form and im trying to construct an if statement to test if its been filled. This is wat ive got <?php $name=$_GET['myname'];
if (isset($name)) {echo 'True';} else {echo 'false';} ?>
I tryed more complex things however true will still be shown reguardless of the contenet of the feild. Thanks
My guess is that when you make the assignment $name = $_GET['myname'], $name becomes set (even if $_GET['myname'] wasn't set, so isset($name) will always return true.
This is what you mean: if (isset($_GET['myname'])) echo 'True'; else echo 'False';
0
Response Number 2
Name: jam14online Date: June 9, 2005 at 03:28:01 Pacific
Reply:
Alternatively, you could use if(!empty($_GET["myname"])), although it's more messy and contradicting.
Whatever's easier for you, though.
0
Response Number 3
Name: fambi Date: June 13, 2005 at 10:17:44 Pacific
Name: Laler Date: June 14, 2005 at 09:28:17 Pacific
Reply:
I think isset() is best, because if you use if (!empty ($_GET)) then when there's no $_GET set, an "undefined variable" notice will show up. Same with directly testing if ($_GET['name'] == '').
And ignoring notices is not a good practice.
0
Response Number 5
Name: Laler Date: June 14, 2005 at 09:30:11 Pacific
Reply:
On a second thought, I think empty() will check if it's: NULL, '', or not set... so using empty() is fine I guess :P
Summary: does anyone know if its possable to get a PHP form to submit to a database on the backend and also send an email with the details to a certain email address with like a verfication link and a username...
Summary: Hi I have a PHP form that inputs things into a database and then later display the stuff in a webpage My main concern is validation of the user's input. I just need a validator or some sort so that th...
Summary: Hey guys, I have an existing php form that runs fine but I was wondering if I can make it so when the submit button is pressed if it can go to 3 different email locations? A;most like "CC ing" someone...