kts Posted March 31, 2008 Share Posted March 31, 2008 Hey, if i have one page that you select which row you want to update with a dropdown and i want it to display in the text box and also a button for submitting the info to update... what would be the best way to do it? Switch statements or if statements? Link to comment https://forums.phpfreaks.com/topic/98736-same-page-to-execute-multiple-taks/ Share on other sites More sharing options...
darkhappy Posted March 31, 2008 Share Posted March 31, 2008 Hey, if i have one page that you select which row you want to update with a dropdown and i want it to display in the text box and also a button for submitting the info to update... what would be the best way to do it? Switch statements or if statements? you want what to display in the text box? you want to output the results of a drop-down as text after updating the db? or you want to update the db via drop down while also processing a text input from the same form? Link to comment https://forums.phpfreaks.com/topic/98736-same-page-to-execute-multiple-taks/#findComment-505278 Share on other sites More sharing options...
kts Posted March 31, 2008 Author Share Posted March 31, 2008 Dropdown has the title Text has the content (from same row) once one button pressed it populates the text with content next button is for updating content so 2 forms, what would be the best way? Link to comment https://forums.phpfreaks.com/topic/98736-same-page-to-execute-multiple-taks/#findComment-505282 Share on other sites More sharing options...
darkhappy Posted March 31, 2008 Share Posted March 31, 2008 this should work - you can also use the isset($_POST['title']) to control whether the submit button for the drop-down even shows up after the user makes the initial selection and the data gets posted back to the page. <?php if(isset($_POST['title'])) { $title = $_POST['title']; $result = mysql_query("SELECT text FROM table WHERE title = '$title'") or die(mysql_error()); } ?> <form id="dropdown" method="post"> <select name="title"> <option>title1</option> <option>title2</option> </select> <input type="submit" value="submit"> </form> <form id="textbox" action="nextpage.php" method="post"> <TEXTAREA name="thetext"> <?php echo $result ?> </TEXTAREA> <INPUT type="submit" value="submit"> </FORM> Link to comment https://forums.phpfreaks.com/topic/98736-same-page-to-execute-multiple-taks/#findComment-505296 Share on other sites More sharing options...
kts Posted March 31, 2008 Author Share Posted March 31, 2008 Thanks, but I was actually trying to not do a "nextpage.php" hehe I guess I can just use another if Link to comment https://forums.phpfreaks.com/topic/98736-same-page-to-execute-multiple-taks/#findComment-505298 Share on other sites More sharing options...
darkhappy Posted March 31, 2008 Share Posted March 31, 2008 Thanks, but I was actually trying to not do a "nextpage.php" hehe I guess I can just use another if yeah you weren't real clear in any of your posts on exactly what you are trying to do but you should be able to tweak that to do what you need you could actually combine the 2 forms if you want and still post to self. - dhappy Link to comment https://forums.phpfreaks.com/topic/98736-same-page-to-execute-multiple-taks/#findComment-505309 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.