FirstBorn Posted December 27, 2008 Share Posted December 27, 2008 Hi, Thank you for reading. I'm using the form submit code Code: <?php print $_SERVER["PHP_SELF"]; ?> and it does not work for some reason... Here is sample code for what I'm using: <?php if($_POST["submit"]) { echo "Submit!"; } else { ?> <html> <head><title>Test Submit</title> </head> <body> <form action="<?php print $_SERVER["PHP_SELF"]; ?>" method="post"> <INPUT TYPE="submit" value="submit"> <input type="reset" value="Reset"> </FORM> <!-- form code ends here! --> </body> </html> <?php } ?> Why is this not working? What I mean by 'not working' is that when you press the button, it seems to reload the page and doesn't seem to count the button click as a 'submit' at all... Any Ideas? Thank you for your help! Thanks, FirstBorn PS. I've used two different webservers / hosts to test this out on, and this script works on NEITHER of them. (Dreamhost and HostGator Servers...) Thanks. Link to comment https://forums.phpfreaks.com/topic/138536-php-form-submit-code-not-working/ Share on other sites More sharing options...
kenrbnsn Posted December 27, 2008 Share Posted December 27, 2008 You need to give the submit button a name for it to be transmitted. BTW, if your script submits to itself, you don't need an action: <form action="" method="post"> <INPUT TYPE="submit" name="submit" value="submit"> <input type="reset" value="Reset"> </FORM> Ken Link to comment https://forums.phpfreaks.com/topic/138536-php-form-submit-code-not-working/#findComment-724339 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.