sunfire Posted May 6, 2008 Share Posted May 6, 2008 Hello, I'm really new to php, I have been asked to learn it I have done most of my work in Coldfusion. I have been searching on how to get the name of a form tag in php. In this example it would be "UpdateList". I looped through the $_POST but did not see it. <form name="UpdateList" action="index.php" method="post"> What am I missing? Thanks, tom Link to comment https://forums.phpfreaks.com/topic/104387-form-name-variable/ Share on other sites More sharing options...
947740 Posted May 6, 2008 Share Posted May 6, 2008 Why do you need the form name? If it is not dynamic, you could just manually enter "UpdateList", but that is a given. Link to comment https://forums.phpfreaks.com/topic/104387-form-name-variable/#findComment-534412 Share on other sites More sharing options...
sunfire Posted May 6, 2008 Author Share Posted May 6, 2008 I would like to use the form name to process the right form info. I have multiple forms on one page and they all go to index.php. Thanks, tom Link to comment https://forums.phpfreaks.com/topic/104387-form-name-variable/#findComment-534431 Share on other sites More sharing options...
conker87 Posted May 6, 2008 Share Posted May 6, 2008 Use a differently named submit button. //form1 <input type="submit" value="submit_button_1" /> //form2 <input type="submit" value="submit_button_2" /> Then use: <?php if ($_POST['submit_button_1']) { // etc } if ($_POST['submit_button_2']) { // etc } ?> Link to comment https://forums.phpfreaks.com/topic/104387-form-name-variable/#findComment-534435 Share on other sites More sharing options...
sunfire Posted May 6, 2008 Author Share Posted May 6, 2008 Thanks, I just created a hidden input element called formName. It's really to bad that PHP does not support this. Thanks again, tom Link to comment https://forums.phpfreaks.com/topic/104387-form-name-variable/#findComment-534592 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.