[nycphp-talk] Session question
Cloud N.
northcloud2000 at yahoo.com
Wed Feb 11 23:55:42 EST 2004
Hello, Hans Zaunere,
Thank you very much for reply my message.
Let me tell you more detail about my pages. In my main
page called dealerorder.php, there is a link to
createTireImage.php (<a href="createTireImg.php">Click
here to create your own cover</a><br><p>).
In createTireImg.php, code like following:
-------
<?php
include ("img_text_config.inc.php");
include ("tbContent.php");
session_start( );
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN">
<html>
<head>
</head>
<body>
<form name="detail" method="post"
action="<?=$_SERVER['PHP_SELF'];?>">
<table>
<tr><td>
<table border="1" BORDERCOLOR="blue">
<tr><td>
backgroud color:
<select name="t_color">
<?php
if (isSet($_POST['t_color']))
$t_color_def = ($_POST['t_color']);
$_SESSION['t_color'] = $t_color_def;
for ($i=0; $i <= 2; $i++)
{
if ($t_color_def == $i)
echo ("<option value=\"$i\"
selected>$color[$i]</option>");
else
echo ("<option
value=\"$i\">$color[$i]</option>");
}
?>
</select>
</td></tr>
<tr><td>
Text color:
<select name="tt_color">
<?php
if (isSet($_POST['tt_color']))
{
$tt_color_def = ($_POST['tt_color']);
}
$_SESSION['tt_color'] =
$_POST['tt_color'];
for ($j=0; $j <= 1; $j++) // only need
first 2 colors
{
if ($tt_color_def == $j)
echo ("<option value=\"$j\"
selected>$color[$j]</option>");
else
echo ("<option
value=\"$j\">$color[$j]</option>");
}
?>
</select>
</td></tr>
<tr><td>
<input type="submit" value='Create image'
name='submit'>
<input name="send" type="hidden" value="true">
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<a href="dealerOrder.php?backtoindex=true">Back To
Main Page</a>
</body>
</html>
-------
In img_text_config.inc.php, I defined an array:
$color = array(0=>"Black", 1=>"White", 2=>"Tan");
After create an image, (it will show up in
dealerorder.php page), I need to describe the new
image's content including background color and text
color. You can see it in the code, i use same way to
set these two colors;
$_SESSION['t_color'] = $_POST['t_color'];
$_SESSION['tt_color'] = $_POST['tt_color'];
In dealerorder.php, i have code like below:
$message = "Image Detail:\n";
$message .= "Backgroud
color:".$color[$_SESSION['t_color']]."\n";
$message .= "Text
color:".$color[$_SESSION['tt_color']]."\n";
The error happens here. $_SESSION['t_color'] is right
(always between 0 and 2), but $_SESSION['tt_color'] is
wrong. $_SESSION['tt_color'] shows 16777215. I have
looked at $_SESSION['tt_color']'s value in
createTireImg.php before I go back to dealerOrder.php,
it was right there. After i click the click in
createTireImg.php, it changed.
Can you figure out what's wrong with it?
Thanks again.
--- Hans Zaunere <hans not junk at nyphp.com> wrote:
>
> > I am working on some pages to create an image
> > dynamically. I need pass information among
> different
> > pages. so I use session strategy.
> > But I get wrong data from some sessions at last
> page.
> > Most data are correct, only few are wrong.
> > Like, I define an array of color.
> > $color = array(0=>"Black", 1=>"White", 2=>"Tan");
> > A text color id should be less than 2, but i get
> its
> > id as 16777215, so I can't get text color name
> from
>
> 16777215 is 2^24, so somewhere your going out of
> range most likely.
>
> > above array according to the id. But I use same
> way to
> > define the background color, it works well.
> >
> > I am using Windows XP OS.
>
> How are you passing the session data around? Maybe
> a couple lines of code would help...
>
> H
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html
More information about the talk
mailing list