gala Posted May 13, 2009 Share Posted May 13, 2009 I am not sure what I'm doing wrong, but this script wouldn't work... When i click on Submit button, nothing happens... would you, please, help.<html><head><title>Test</title></head><body><form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <input type="hidden" name="_submit_check" value="1"/> Start: <input name="start" type="text" size="8"> End: <input name="end" type="text" size="8"> <input type="submit" name="Submit" value="Submit"> </form><?phpif (isset($_POST['submitted'])) { foo();}function foo(){echo "Hello";}?></body></html> Link to comment Share on other sites More sharing options...
Ingolme Posted May 13, 2009 Share Posted May 13, 2009 Where's the <input> element named "submitted"? Link to comment Share on other sites More sharing options...
jlhaslip Posted May 13, 2009 Share Posted May 13, 2009 Check for the hidden submit value. <?phpif (isset($_POST['_submit_check']) && ( $_POST['_submit_check'] == "1" )) {foo();} Link to comment Share on other sites More sharing options...
Synook Posted May 13, 2009 Share Posted May 13, 2009 I thought since PHP is procedural foo() needs to be defined before you call it? Link to comment Share on other sites More sharing options...
justsomeguy Posted May 13, 2009 Share Posted May 13, 2009 No, the parser takes more than one pass through the file. The first pass is just to define everything before it actually executes. As long as it's defined in the source somewhere it will get found before execution starts. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.