boxden88 Posted February 21, 2015 Share Posted February 21, 2015 Hello everyone i was just seeing if anyone could help me with combining my php forms so that they read from 1 file instead of the 3 individual pages....i took out my code details just so they are not on the internet but the setup of my pages are still in there. can anyone markup my file so that all the content from the 3 forms can be read from 1 form please.here is my file <!DOCTYPE html> <html> <head> <title></title> <style> @import url('css/styles.css'); </style> </head> <body> <div class="main"> <form method="post" action="form_preview.php"> ///////////// this is just where my info is going ///////////// this is just where my info is going ///////////// this is just where my info is going ///////////// this is just where my info is going ///////////// this is just where my info is going ///////////// this is just where my info is going ///////////// this is just where my info is going </div> </fieldset> </form> </div> </body> </html> second form <?php setcookie('blank', $_POST['fname']); setcookie('blank', $_POST['fname']); setcookie('blank', $_POST['fname']); setcookie('blank', $_POST['fname']); setcookie('blank', $_POST['fname']); setcookie('blank', $_POST['fname']); setcookie('blank', $_POST['fname']); setcookie('blank', $_POST['fname']); setcookie('blank', $_POST['fname']); ?> <!DOCTYPE html> <html> <head> <title></title> <style> @import url('css/styles.css'); </style> </head> <body> <div class="main"> <fieldset> <legend>Information</legend> ///////////// this is just where my info is going ///////////// this is just where my info is going ///////////// this is just where my info is going ///////////// this is just where my info is going ///////////// this is just where my info is going ///////////// this is just where my info is going ///////////// this is just where my info is going <input type="button" onclick="javascript: location.href = 'form_entry.php'" value="Edit" /> <input type="button" onclick="javascript: location.href = 'form_confirmed.php'" value="Finish" /> </div> </div> </fieldset> </div> </body> </html> third form <?php setcookie('blank', $_POST['fname']); setcookie('blank', $_POST['fname']); setcookie('blank', $_POST['fname']); setcookie('blank', $_POST['fname']); setcookie('blank', $_POST['fname']); setcookie('blank', $_POST['fname']); setcookie('blank', $_POST['fname']); setcookie('blank', $_POST['fname']); ?> <!DOCTYPE html> <html> <head> <title>/title> <style> @import url('css/styles.css'); </style> </head> <body> <div class="main"> <h2>Thank you, your data has been submitted.</h2> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/294788-combing-3-php-files-into-one/ Share on other sites More sharing options...
ginerjm Posted February 22, 2015 Share Posted February 22, 2015 (edited) You want to "combine" 3 existing files, presumably containing different html, into one php(?) file? Why not just use some logic to decide which one to include or which one to actually execute? Something like: if ($pass == 1) { // first pass thru this code - show this html echo (stuff) } elseif ($pass == 2) { // second pass - show different html echo (stuff) } elseif ($pass == 3) { // third pass echo (stuff) } else { echo "Invalid pass switch"; exit(); } Edited February 22, 2015 by ginerjm Quote Link to comment https://forums.phpfreaks.com/topic/294788-combing-3-php-files-into-one/#findComment-1506436 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.