I’m a PHP newbie trying to sort some basics out. I have a user-form that leads to a mysql select query, which works fine. Every tutorial I have found so far has the standard form tag, ie: action=’script.php’ method=’post’. This obviously opens script.php in a new tab/window though.
If I don’t want to display what’s fetched from my db on a different webpage I have to put the html and php in one document together. I didn’t think this is how you would really want to do it though.
My specific question is when you want to display stuff on the same page do you just put everything in together within one document and let users hit the submit button?
Advertisement
Answer
OR you can put 2 different pages that act as 1 by using INCLUDE FUNCTION script1.php <form action="script2.php" method="post" name="myform"> ... <input type="submit" name='submit_button' value="Submit" /> <input </form> --------------- script2.php include 'script1.php'; if(isset($_POST['submit_button'] {.......}