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 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 > > > > > > > > > > -- > > 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