Re: Re: $_session/$_cookie trouble

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ok, working code.  I'm sure there is some left over code that is not 
actually working, but I have been playing frankenstein all day. Basically a 
vistor fills in 3 (only two set so far) inputs to see if they qualify for a 
rebate.  If they do, they can go on to file two to submit their information.

This is my first project using $_cookie or $_session.  I have done an 
exercise or two in lessons using them, but this is my first attempt from 
scratch.

File1 of 2
<?php
session_start();
?>

<?php
$_SESSION=array('$sale_value', 'assess_value');


$sale_value=$_POST['sale'];
$assess_value=$_POST['assess'];

$mil_rate=.03965;
$ratio=.51;

$present_tax=($assess_value) * ($mil_rate);
$correct_tax=($sale_value)*($ratio)*($mil_rate);
$savings=($present_tax)-($correct_tax);

if ($savings > 0.00){
echo '<h2 style="margin:0;color:#ff0000;">Yes, Your property appears to 
qualify!</h2><br /><br />';
}
if ($savings < 0.00){
echo '<h3 style="margin:0;">NO, Your property does not appear to qualify. 
</h3><br /><br />';
}
echo 'According to the information you have entered<br />';?><br />
<?php
echo "You believe your home would today sell for 
$".number_format($sale_value)."<br />";
echo "Your current tax assessment is $".number_format($assess_value)."<br 
/>";
echo 'You live in <br /><br />';
echo 'According to preliminary calculations<br /><br />';
echo "You are currently paying now  $".number_format($present_tax, 2)."<br 
/><br />";
echo "According to the information you have submitted, your taxes should be 
$ ".number_format($correct_tax, 2)."<br />";
?>
<br/><?php
if ($savings > 0.00){
echo "According to our preliminary calculations, a successful assessment 
appeal could save you annually on your current real estate taxes. <b>$ 
".number_format($savings, 2)."</b> ";
}
if ($savings < 0.00){
echo 'It does not appear that an appeal would be successful in saving you 
money this year. If property values in your area continue to decline, you 
may wish to revisit the issue next year.</h3><br /><br />';
}

$_SESSION['sale_value'] ='$sale_value';
$_SESSION['assess_value'] ='$assess_value';

?>
<p style="font-size:.8em; color:#666666;">If you feel you have entered 
incorrect information, hit your browsers back button to re-calculate with 
the new information</p><br />
<p style="text-align:center; color:#FF0000; font-size:1.4em;"><b>Important 
Notice!</b></p>
<p style="text-align:center; border:#990000 1px solid;">This <b>DOES NOT</b> 
constitute a legal opinion by !<br /> No information has been submitted.</p>
<p>In order to proceed with an assessment appeal, you must contact my office 
that we may verify all pertinent information regarding your a real estate 
assessment appeal case</p>

<p> To submit this information to , please complete the following form.</p>

<form action="sendresult.inc.php" method="post">
First Name <input name="fname" type="text" /><br /><br />
Last Name <input name="lname" type="text" /><br /><br />
Property Street Address <input name="street" type="text" /> <br /><br />
Town or City <input name="town" type="text" /><br/><br />
Zip Code <input name="zip" type="text" /><br /><br />
County <input name="county" type="text" /><br /><br />
Phone Number <input name="phone" type="text" /><br /><br />
E-Mail Address <input name="email" type="text" /><br /><br />
<input name="$assess_value" type="hidden" value="$assess_value">
<input name="submit" type="submit" value="Submit">
</form>

File 2

<?php

?>
<!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=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
$fname=STRIPSLASHES($_POST['fname']);
$lname=STRIPSLASHES($_POST['lname']);
$street=STRIPSLASHES($_POST['street']);
$town=STRIPSLASHES($_POST['town']);
$zip=STRIPSLASHES($_POST['zip']);
$county=STRIPSLASHES($_POST['county']);
$phone=STRIPSLASHES($_POST['phone']);
$email=STRIPSLASHES($_POST['email']);
$assess_value=$_COOKIE['assess_value'];
$sale_value=$_COOKIE['sale_value'];


echo "Thank you $fname for your submission!<br />";
echo "You have submitted the following information.<br />";
echo "Name:$fname  $lname<br />";
echo "Address:$street $town  $zip<br />";
echo "Phone Number: $phone<br />";
echo "E-Mail Address: $email<br />";
echo "You believe your home would sell for $"; echo $_COOKIE['sale_cookie']; 
?><br /><?php
echo "Your assessment value is $"; echo $_COOKIE['assess_cookie'];?><br 
/><?php
echo "You live in $county<br />";





?>
</body>
</html>



"Lists" <lists@xxxxxxx> wrote in message news:49F790ED.5040204@xxxxxxxxxx
> Andrew Hucks wrote:
>> $sale_value would have worked if it hadn't been in single quotes, I
>> believe. (Assuming it was populated.).
>
> Which it wasn't.. ;-) according to Gary's last post. He assigned it now
> with 'sale'.. however, I think it should rather be in double quotes 
> ("sale") if he wants to get the posted value.
>
> echo $sale_value;
>
> now works because sale_value has been assigned a value.
>
> But:
> echo $_COOKIE['sale_cookie'];
>
> I would guess will still not work.. until landing on the
> next page, or reloading the first page.
>
>
>  When you put it in quotes, you
>> were making the cookie's value a string instead of a variable. So, the
>> value would actually have literally been $sale_value, rather than the
>> value for that variable. It is working with $_POST['sale'] because
>> there are no single quotes. :-p.
>
>
> Gary, if you want to post your "working" code, we could probably
> tell you the "why's"... and it would also cater to my curiosity. ;-)
>
> Donovan
>
>
> -- 
>   =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o
>   D. BROOKE                       EUCA Design Center
>                                WebDNA Software Corp.
>   WEB:> http://www.euca.us  |   http://www.webdna.us
>   =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o
>   WebDNA: [** Square Bracket Utopia **] 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux