Jump to content

updating a session variable


jalea148

Recommended Posts

I have 3 pages, each with forms; all in the same domain. The data from the first passes to the 2nd and 3rd ok. On the 2nd I create the session variables:

<?php

session_start();

session_destroy();

session_register("sessFirst");

session_register("sessLast");

session_register("sessAddr");

session_register("sessCity");

session_register("sessState");

session_register("sessZip");

session_register("sessPhone");

session_register("sessXmail");

session_register("sessApplSex");

$sessFirst = $HTTP_POST_VARS['First'];

$sessLast = $HTTP_POST_VARS['Last'];

$sessAddr = $HTTP_POST_VARS['Addr'];

$sessCity = $HTTP_POST_VARS['City'];

$sessState = $HTTP_POST_VARS['State'];

$sessZip = $HTTP_POST_VARS['Zip'];

$sessPhone = $HTTP_POST_VARS['Phone'];

$sessXmail = $HTTP_POST_VARS['Xmail'];

$sessApplSex = "xxx";

?>

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>

<!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">

……………….

 

The form on page 2 has a radio button whose value I would like to pass to page3.

 

Here’s some snippets:

 

……………

<td ">  

  <input name="Appl_Sex" id="App_Male" class="req" type="radio" value="Male" tabindex="20" onclick="change(this.value)"/>  <label> Male </label>

  <input type="radio" name="Appl_Sex" id="App_Female" class="req" value="Female" tabindex="21" onclick="change(this.value)"><label > Female </label>

</td>

………………

<script>

function change(RadioValue) {

$_SESSION['sessApplSex']=RadioValue;

}

</script>

 

On page 3, 'sessApplSex' has the value ‘xxx’

 

Also on Page 3, I tried to use $_POST[Appl_Sex] with similar difficulty.

 

 

Link to comment
https://forums.phpfreaks.com/topic/60609-updating-a-session-variable/
Share on other sites

I haven’t received any responses, so here’s a revision of my problem.

 

I have 3 pages, each with forms; all in the same domain. The data from the first page passes to the 2nd and 3rd ok {First, Last, Addr, City}. On the 2nd I create all the session variables:

<?php

session_start();

session_destroy();

session_register("sessFirst");

session_register("sessLast");

session_register("sessAddr");

session_register("sessCity");

session_register("sessApplSex");

session_register("sessCounty");

$sessFirst = $HTTP_POST_VARS['First'];

$sessLast = $HTTP_POST_VARS['Last'];

$sessAddr = $HTTP_POST_VARS['Addr'];

$sessCity = $HTTP_POST_VARS['City'];

$sessApplSex = $_POST['Appl_Sex'];

$sessCounty = $_POST['County'];

?>

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>

<!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">

……………….

 

The form on page 2 has two additional fields, County and Appl_Sex {= a radio button} whose values I would like to pass to page3. these are validated to insure they are not null.

 

Here’s some snippets:

 

……………

<td >

<input name="Appl_Sex" id="App_Male" class="req" type="radio" value="Male" tabindex="20"/><label> Male </label>

<input type="radio" name="Appl_Sex" id="App_Female" class="req" value="Female" tabindex="21" /><label > Female </label>

</td>

………………

<form action="http://www.insurance.com/wexxx.php" method="post" enctype="multipart/form-data" name="quote_form" id="quote_form" onsubmit="return validateForm()">

…………………..

 

On page 3, value="<?php echo $_POST['Appl_Sex']; ?>" /> and value="<?php echo $sessCounty; ?>" /> both produce value = “”.

 

Any clues how to access these page 2 form values on page 3? Is this sort of issue better resolved with AJAX?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.