woolyg Posted September 17, 2007 Share Posted September 17, 2007 Hi all, In a PHP file 'main.php' I have <?php include 'header.php'; include 'login.php'; include 'body.php'; include 'footer.php'; ?> Login.php has a form on it to allow the user to log in to the site. Body.php has a form on it to allow a user to post a message. What I'm finding is that the 'submit' button on 'body.php' actually calls the form from 'login.php'. Does PHP have issues when there are 2 separate forms doing 2 saperate things displayed on the same page - is there anything I need to look out for? Any observations appreciated. - woolyg. Quote Link to comment https://forums.phpfreaks.com/topic/69688-multiple-forms-different-php-documents-same-page/ Share on other sites More sharing options...
bobbyM Posted September 17, 2007 Share Posted September 17, 2007 Do the two forms have the same name? Quote Link to comment https://forums.phpfreaks.com/topic/69688-multiple-forms-different-php-documents-same-page/#findComment-350137 Share on other sites More sharing options...
woolyg Posted September 17, 2007 Author Share Posted September 17, 2007 Nope. I've been careful to identify them differently.. Quote Link to comment https://forums.phpfreaks.com/topic/69688-multiple-forms-different-php-documents-same-page/#findComment-350139 Share on other sites More sharing options...
marcus Posted September 17, 2007 Share Posted September 17, 2007 <?php include "header.php"; $act = $_GET['act']; switch($act){ case login: include "login.php"; break; case body: include "body.php"; break; default: include "no_action.php"; } include "footer.php"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/69688-multiple-forms-different-php-documents-same-page/#findComment-350141 Share on other sites More sharing options...
bobbyM Posted September 17, 2007 Share Posted September 17, 2007 Can you post the two forms (the whole form just in case ) Quote Link to comment https://forums.phpfreaks.com/topic/69688-multiple-forms-different-php-documents-same-page/#findComment-350143 Share on other sites More sharing options...
TheFilmGod Posted September 17, 2007 Share Posted September 17, 2007 Um, your submit button needs a different " name="..." ". You can use a hidden html form field to check if that form was the one submitted! As a recommendation, the login script should use the name for the submit button as "login" or something. It will mess up your future php coding! Quote Link to comment https://forums.phpfreaks.com/topic/69688-multiple-forms-different-php-documents-same-page/#findComment-350145 Share on other sites More sharing options...
woolyg Posted September 17, 2007 Author Share Posted September 17, 2007 Cool, thanks for the input everyone. I'm going to go back and bang my head off it for a while. I'll come back with any issues! - woolyg. Quote Link to comment https://forums.phpfreaks.com/topic/69688-multiple-forms-different-php-documents-same-page/#findComment-350150 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.