Re: [PHP] Simple HTML-Form Question
Has there changed something in PHP-Coding since I've learned it a few years before? Since PHP v4.1.0 you access $name as $_GET['name'], unless you change register_globals in php.ini to 'on' so it gets to how it used to be before. There seems to be a diffrence between clicking the send button and pressing Enter. Has this always been so? Submit button was always different form Enter key in that hitting 'submit' also sends it in the GET (or POST). This has always been so and it is actually browser's issue, that's how *browser* sends the GET. Though, it would have nothing to do yet with your first question. -- Maxim Maletsky [EMAIL PROTECTED] www.PHPBeginner.com // where PHP Begins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Simple HTML-Form Question
Hi, I've updated to PHP 4.2.3 and wrote this simple Script: ? if (isset($name)) { echo Hallo $name; } else { echo FORM action='test.php' method=get input type=text name=name input type=submit name=action value=sendit; } ? I would expect the following: The site starts with the form, then I enter my name (Lars) and click the send-button. Then the script says Hello Lars. The actual output is: The site starts with the form, I enter my name and click the button, then the form keeps being there, no Hello-message. Has there changed something in PHP-Coding since I've learned it a few years before? There seems to be a diffrence between clicking the send button and pressing Enter. Has this always been so? regards Lars -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple HTML-Form Question
register_globals defaults now to off. Use the superglobals instead. ? if (isset($_GET['name'])) { echo Hallo .$GET['name']; } else { echo FORM action='test.php' method=get input type=text name=name input type=submit name=action value=sendit; } ? Sascha Am Sonntag, 13. Oktober 2002 23:40 schrieb Lars H. Korte: Hi, I've updated to PHP 4.2.3 and wrote this simple Script: ? if (isset($name)) { echo Hallo $name; } else { echo FORM action='test.php' method=get input type=text name=name input type=submit name=action value=sendit; } ? I would expect the following: The site starts with the form, then I enter my name (Lars) and click the send-button. Then the script says Hello Lars. The actual output is: The site starts with the form, I enter my name and click the button, then the form keeps being there, no Hello-message. Has there changed something in PHP-Coding since I've learned it a few years before? There seems to be a diffrence between clicking the send button and pressing Enter. Has this always been so? regards Lars -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple HTML-Form Question
Sascha Cunz wrote this stuff back on Mon, 14 Oct 2002 00:09:58 +0200: register_globals defaults now to off. Use the superglobals instead. ? if (isset($_GET['name'])) { echo Hallo .$GET['name']; } else { echo FORM action='test.php' method=get input type=text name=name input type=submit name=action value=sendit; } ? Sascha The value of name for the submit button is wrong - it should be the same as the value you gave the isset statement, in this case it should be input type=submit name=name value=sendit Better yet is to use isset($submit) and the value for the submit statement is also name=submit - input type=submit name=submit value=sendit of course value is optional. So you end up with this - ? if (isset($_GET['submit'])) { echo Hallo .$GET['name']; } else { echo FORM action='test.php' method=get input type='text' name='name' input type='submit' name='submit' value='sendit'; } ? -- Chip Am Sonntag, 13. Oktober 2002 23:40 schrieb Lars H. Korte: Hi, I've updated to PHP 4.2.3 and wrote this simple Script: ? if (isset($name)) { echo Hallo $name; } else { echo FORM action='test.php' method=get input type=text name=name input type=submit name=action value=sendit; } ? I would expect the following: The site starts with the form, then I enter my name (Lars) and click the send-button. Then the script says Hello Lars. The actual output is: The site starts with the form, I enter my name and click the button, then the form keeps being there, no Hello-message. Has there changed something in PHP-Coding since I've learned it a few years before? There seems to be a diffrence between clicking the send button and pressing Enter. Has this always been so? regards Lars -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple HTML-Form Question
This beautifies it (even makes it a bit more secure), but one doesn't need it really; should have worked without these changes, too. (Of course, it's better to include these changes) Sascha The value of name for the submit button is wrong - it should be the same as the value you gave the isset statement, in this case it should be input type=submit name=name value=sendit Better yet is to use isset($submit) and the value for the submit statement is also name=submit - input type=submit name=submit value=sendit of course value is optional. So you end up with this - ? if (isset($_GET['submit'])) { echo Hallo .$GET['name']; } else { echo FORM action='test.php' method=get input type='text' name='name' input type='submit' name='submit' value='sendit'; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple HTML-Form Question
Sascha Cunz wrote this stuff back on Mon, 14 Oct 2002 01:13:53 +0200: This beautifies it (even makes it a bit more secure), but one doesn't need it really; should have worked without these changes, too. (Of course, it's better to include these changes) Sascha No it shouldn't have worked the way you had it originally. The isset statement HAS to have the same value as the submit buttom name or it won't work at all. As for the beautify part, that's just the way I write my code, that doesn't matter at all to whether or not the script will work. -- Chip The value of name for the submit button is wrong - it should be the same as the value you gave the isset statement, in this case it should beinput type=submit name=name value=sendit Better yet is to use isset($submit) and the value for the submit statement is also name=submit - input type=submit name=submit value=sendit of course value is optional. So you end up with this - ? if (isset($_GET['submit'])) { echo Hallo .$GET['name']; } else { echo FORM action='test.php' method=get input type='text' name='name' input type='submit' name='submit' value='sendit'; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple HTML-Form Question
Hello, Just for the sake of the argument... On Monday, October 14, 2002 10:44 AM Chip Wiegand wrote: Sascha Cunz wrote this stuff back on Mon, 14 Oct 2002 01:13:53 +0200: This beautifies it (even makes it a bit more secure), but one doesn't need it really; should have worked without these changes, too. (Of course, it's better to include these changes) Sascha No it shouldn't have worked the way you had it originally. The isset statement HAS to have the same value as the submit buttom name or it won't work at all. Yes it will. Try it. ;) Of course, I didn't mean to say that it will work the way you want it. I just wanted to say that it would still work even though the isset statement doen't have the same value with the submit button. Remember, isset() is basically a function to check if something is set or not... So, changing this if (isset($_GET['submit'])) to this if (isset($_GET['name'])) will have a similar result (for the short code discussed here). - E PS Typo: (should be $_GET['name']) echo Hallo .$GET['name']; As for the beautify part, that's just the way I write my code, that doesn't matter at all to whether or not the script will work. -- Chip The value of name for the submit button is wrong - it should be the same as the value you gave the isset statement, in this case it should beinput type=submit name=name value=sendit Better yet is to use isset($submit) and the value for the submit statement is also name=submit - input type=submit name=submit value=sendit of course value is optional. So you end up with this - ? if (isset($_GET['submit'])) { echo Hallo .$GET['name']; } else { echo FORM action='test.php' method=get input type='text' name='name' input type='submit' name='submit' value='sendit'; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fw: Re: [PHP] Simple HTML-Form Question
Yep, I've been going over this with John off-list, I learned something new tonite. One thing about his script - it doesn't print the text entered in the box, it only prints the work Hallo. To fix that would require adding . $name; to the end of the echo statement. Regards, -- Chip Edwin wrote this stuff back on Mon, 14 Oct 2002 11:55:28 +0900: Hello, Just for the sake of the argument... On Monday, October 14, 2002 10:44 AM Chip Wiegand wrote: Sascha Cunz wrote this stuff back on Mon, 14 Oct 2002 01:13:53 +0200: This beautifies it (even makes it a bit more secure), but one doesn't need it really; should have worked without these changes, too. (Of course, it's better to include these changes) Sascha No it shouldn't have worked the way you had it originally. The isset statement HAS to have the same value as the submit buttom name or it won't work at all. Yes it will. Try it. ;) Of course, I didn't mean to say that it will work the way you want it. I just wanted to say that it would still work even though the isset statement doen't have the same value with the submit button. Remember, isset() is basically a function to check if something is set or not... So, changing this if (isset($_GET['submit'])) to this if (isset($_GET['name'])) will have a similar result (for the short code discussed here). - E PS Typo: (should be $_GET['name']) echo Hallo .$GET['name']; As for the beautify part, that's just the way I write my code, that doesn't matter at all to whether or not the script will work. -- Chip The value of name for the submit button is wrong - it should be the same as the value you gave the isset statement, in this case it should beinput type=submit name=name value=sendit Better yet is to use isset($submit) and the value for the submit statement is also name=submit - input type=submit name=submit value=sendit of course value is optional. So you end up with this - ? if (isset($_GET['submit'])) { echo Hallo .$GET['name']; } else { echo FORM action='test.php' method=get input type='text' name='name' input type='submit' name='submit' value='sendit'; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Fw: Re: [PHP] Simple HTML-Form Question
I would quote get in method=get and end the /form for starters. Keith Vance Vance Consulting LLC www.vanceconsulting.net (206) 355-2399 Try my open source PHP authentication system, Rampart by visiting http://rampart.sourceforge.net/. Commercial support is available at, http://www.vanceconsulting.net/support/. On Sun, 13 Oct 2002, Chip Wiegand wrote: Yep, I've been going over this with John off-list, I learned something new tonite. One thing about his script - it doesn't print the text entered in the box, it only prints the work Hallo. To fix that would require adding . $name; to the end of the echo statement. Regards, -- Chip Edwin wrote this stuff back on Mon, 14 Oct 2002 11:55:28 +0900: Hello, Just for the sake of the argument... On Monday, October 14, 2002 10:44 AM Chip Wiegand wrote: Sascha Cunz wrote this stuff back on Mon, 14 Oct 2002 01:13:53 +0200: This beautifies it (even makes it a bit more secure), but one doesn't need it really; should have worked without these changes, too. (Of course, it's better to include these changes) Sascha No it shouldn't have worked the way you had it originally. The isset statement HAS to have the same value as the submit buttom name or it won't work at all. Yes it will. Try it. ;) Of course, I didn't mean to say that it will work the way you want it. I just wanted to say that it would still work even though the isset statement doen't have the same value with the submit button. Remember, isset() is basically a function to check if something is set or not... So, changing this if (isset($_GET['submit'])) to this if (isset($_GET['name'])) will have a similar result (for the short code discussed here). - E PS Typo: (should be $_GET['name']) echo Hallo .$GET['name']; As for the beautify part, that's just the way I write my code, that doesn't matter at all to whether or not the script will work. -- Chip The value of name for the submit button is wrong - it should be the same as the value you gave the isset statement, in this case it should beinput type=submit name=name value=sendit Better yet is to use isset($submit) and the value for the submit statement is also name=submit - input type=submit name=submit value=sendit of course value is optional. So you end up with this - ? if (isset($_GET['submit'])) { echo Hallo .$GET['name']; } else { echo FORM action='test.php' method=get input type='text' name='name' input type='submit' name='submit' value='sendit'; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php