Jump to content

Recommended Posts

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>

Link to comment
https://forums.phpfreaks.com/topic/294788-combing-3-php-files-into-one/
Share on other sites

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 by ginerjm
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.