Jump to content

Handling Html Forms With Php Redux


gala

Recommended Posts

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

I thought since PHP is procedural foo() needs to be defined before you call it?

Link to comment
Share on other sites

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...