Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow Online Quote Sessions

    Whats wrong with my code??

    its not storing the data for more then 1 step.
    on step 1: put in project, and it show on step 2 but not step 3, only step 2 shows up on step 3.
    PHP Code:
    <?
    session_start
    ();// This connects to the existing session
    /*
    session_register("project");// Create a session variable called first_name
    session_register("company");
    session_register("website");
    */
    $_SESSION['project'] = $_POST['project'];
    $_SESSION['company'] = $_POST['company'];
    $_SESSION['website'] = $_POST['website'];    

    ?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>Quotes</title>
    <link href="nb2.css" rel="stylesheet" type="text/css" />
    </head>

    <body>

    Welcome to online website Quote System.<br />
    <a href="index2.php?cmd=delete" target="_self">Destroy session</a> | <a href="index2.php?step=1" target="_self">Start Quote</a><br /><br />

    Project: <? echo $_SESSION['project']; ?><br><br />
    Company: <? echo $_SESSION['company']; ?><br><br />

    <hr />
    <?

    if($_GET["step"]=="1"){    
        echo 
    'step one<br><br>';
    ?>
        
        <form method="post" id="main-form" name="quicknote" action="index2.php?step=2" enctype="multipart/form-data">
        
            <legend>Creative Brief</legend>
            Project <input name="project" type="text" size="25" />
            <p class="submit_field">
            <input type="image" src="images/next_button.png" value="Submit" name="Submitform" alt="Submit Form" />
            </p>
        </form>
        <?
            
    if($_POST['Submit']){
                
    $project $_POST['project'];
                
            }
        
    ?>
                
    <? ?>

    <?
    if($_GET["step"]=="2"){
        echo 
    "step 2 <br><br>";
    ?>
    Project: <? echo $_SESSION['project']; ?><br><br />
        <form method="post" id="main-form" name="quicknote" action="index2.php?step=3" enctype="multipart/form-data">
            <legend>Creative Brief 2</legend>
            Company: <input name="company" type="text" size="25" />
            <p class="submit_field">
            <input type="image" src="images/next_button.png" value="Submit" name="Submitform" alt="Submit Form" />
            </p>
        </form>
        <?
            
    if($_POST['Submit']){
            
    $project = ($_SESSION['project']);
            
    $company = ($_SESSION['company']);
               
    //$_SESSION['company'][$company]=$_POST['company'];
            
    }
        
    ?>

    <? ?>

    <?
    if($_GET["step"]=="3"){
        echo 
    "step 3 <br><br>";
    ?>
        <legend>Details</legend>
        Project: <?=$_SESSION['project']?><bR />
        Company: <?=$_SESSION['company']?><br />

    <? ?>

    <?
    if($_GET["step"]=="4"){    
        echo 
    "step 4";
    ?>
         //nothing yet.

    <? ?>

    <?
    if($_GET["cmd"]=="delete"){    
        echo 
    "Destroy";
    ?>
         <? session_destroy(); ?>

    <? ?>

    </body>
    </html>

  • #2
    New Coder
    Join Date
    Jul 2005
    Posts
    81
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Check out that code it's a little bit modified
    PHP Code:
    <?
    session_start
    ();// This connects to the existing session
    /*
    session_register("project");// Create a session variable called first_name
    session_register("company");
    session_register("website");
    */


    $_SESSION['project'] = (!isset($_SESSION['project'])?$_POST['project']:$_SESSION['project']);
    $_SESSION['company'] = (!isset($_SESSION['company'])?$_POST['company']:$_SESSION['company']);
    $_SESSION['website'] = (!isset($_SESSION['website'])?$_POST['website']:$_SESSION['website']);

    //var_dump($_SESSION);

    ?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>Quotes</title>
    <link href="nb2.css" rel="stylesheet" type="text/css" />
    </head>

    <body>

    Welcome to online website Quote System.<br />
    <a href="<?=$_SERVER['PHP_SELF']?>?cmd=delete" target="_self">Destroy session</a> | <a href="<?=$_SERVER['PHP_SELF']?>?step=1" target="_self">Start Quote</a><br /><br />

    Project: <? echo $_SESSION['project']; ?><br><br />
    Company: <? echo $_SESSION['company']; ?><br><br />

    <hr />
    <?

    if($_GET["step"]=="1"){    
        echo 
    'step one<br><br>';
    ?>
        
        <form method="post" id="main-form" name="quicknote" action="<?=$_SERVER['PHP_SELF']?>?step=2" enctype="multipart/form-data">
        
            <legend>Creative Brief</legend>
            Project <input name="project" type="text" size="25" />
            <p class="submit_field">
            <input type="image" src="images/next_button.png" value="Submit" name="Submitform" alt="Submit Form" />
            </p>
        </form>
        <?
            
    if($_POST['Submit']){
                
    $project $_POST['project'];
                
            }
        
    ?>
                
    <? ?>

    <?
    if($_GET["step"]=="2"){
        echo 
    "step 2 <br><br>";
    ?>
    Project: <? echo $_SESSION['project']; ?><br><br />
        <form method="post" id="main-form" name="quicknote" action="<?=$_SERVER['PHP_SELF']?>?step=3" enctype="multipart/form-data">
            <legend>Creative Brief 2</legend>
            Company: <input name="company" type="text" size="25" />
            <p class="submit_field">
            <input type="image" src="images/next_button.png" value="Submit" name="Submitform" alt="Submit Form" />
            </p>
        </form>
        <?
            
    if($_POST['Submit']){
            
    //$project = ($_SESSION['project']);
            
    $company = ($_POST['company']);
               
    //$_SESSION['company'][$company]=$_POST['company'];
            
    }
        
    ?>

    <? ?>

    <?
    if($_GET["step"]=="3"){
        echo 
    "step 3 <br><br>";
    ?>
        <legend>Details</legend>
        Project: <?=$_SESSION['project']?><bR />
        Company: <?=$_SESSION['company']?><br />

    <? ?>

    <?
    if($_GET["step"]=="4"){    
        echo 
    "step 4";
    ?>
         //nothing yet.

    <? ?>

    <?
    if($_GET["cmd"]=="delete"){    
        echo 
    "Destroy";
    ?>
         <? session_destroy(); ?>

    <? ?>

    </body>
    </html>
    If you can not find a decision, maybe you have to try to change a problem

    http://www.gunman.co.nr
    http://bglinux.org


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •