L3P3000 Posted May 9, 2012 Share Posted May 9, 2012 Sorry,guys,just can`t get thru: 1.there`s a file index.php <html> <body> <form action=/open.php> <button name=Jack value="150" type=submit>Send Form</button> </form> </body> </html> 2.there`s another file open.php <? echo $Jack; ?> Press the button,in the address box it says: http://mysite.net/open.php?Jack=150 But nothing happens,open.php doesn`t work.I got Denwer,open.php is in www.mysite.net. Please,help.Thanx. Quote Link to comment Share on other sites More sharing options...
NLT Posted May 9, 2012 Share Posted May 9, 2012 You haven't added a POST method to your form. <html> <body> <form action="open.php" method="post"> <button name="Jack" value="150" type="submit">Send Form</button> </form> </body> </html> Quote Link to comment Share on other sites More sharing options...
L3P3000 Posted May 9, 2012 Author Share Posted May 9, 2012 yeah,good point,thanx,but it doesn`t work anyway. Quote Link to comment Share on other sites More sharing options...
Jessica Posted May 9, 2012 Share Posted May 9, 2012 Try $_POST['Jack'] not $Jack. Quote Link to comment Share on other sites More sharing options...
RedHat Posted May 9, 2012 Share Posted May 9, 2012 <html> <body> <form action="open.php" method="post"> <button name="Jack" value="150" type=submit>Send Form</button> </form> </body> </html> 2.there`s another file open.php <? echo $_POST['$Jack']; ?> That should work for you. Quote Link to comment Share on other sites More sharing options...
Ivan Ivković Posted May 9, 2012 Share Posted May 9, 2012 No, it's $_POST['Jack'] without the dollar sign. Quote Link to comment Share on other sites More sharing options...
Andy-H Posted May 9, 2012 Share Posted May 9, 2012 Is this from a book? If so I suggest you get a more up-to-date book to learn from. The code relies on register_globals which was depreciated in 5.3.0 and removed in PHP 5.4.0 Quote Link to comment Share on other sites More sharing options...
jcbones Posted May 10, 2012 Share Posted May 10, 2012 Try: <?php //important, if short tags are turned off <? will not do anything. echo $_POST['Jack']; ?> Quote Link to comment Share on other sites More sharing options...
Barand Posted May 10, 2012 Share Posted May 10, 2012 Is this from a book? If so I suggest you get a more up-to-date book to learn from. The code relies on register_globals which was depreciated in 5.3.0 and removed in PHP 5.4.0 Use of register globals was advised aginst as long ago as PHP Version 4.2 (2002) as this extract from php.net release history shows Version 4.2.0 22-Apr-2002 ■ATTENTION!! register_globals defaults to 'off' now !!! Quote Link to comment Share on other sites More sharing options...
L3P3000 Posted May 11, 2012 Author Share Posted May 11, 2012 short tags are On,$_Post['Jack'] didnt work either.Thanx,anyway. Quote Link to comment Share on other sites More sharing options...
Jessica Posted May 11, 2012 Share Posted May 11, 2012 It's $_POST, not $_Post. post your new code so we can see all the changes. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.