Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

45 users online



Online Quote Sessions

Online Quote Sessions

Currently viewing this thread: 1 (0 members and 1 guests)


james182

james182

Neverside Newbie
Status: Offline!

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.

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>

BigToach

BigToach

Neversidian
Status: Offline!

get rid of the session_* functions (except session_start())

To register session vars declare them with $_SESSION['var'] and to get rid of a session var just do unset($_SESSION['var']);

Its probably something to do with globals or something

___________________

Neverside Development Director
PHP Snippets
BigToach.com - IT WORKS, TOACHY!

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0178 seconds.