Hi,
I am trying find out why an piece of code will not execute in PHP. I am just learning, so I don't understand why this is happening.
I installed Firebug for Firefox on my PC so I can debug the PHP code. I have an include that calls another file, but it does not seem to actually get called.
Here is the code:
if ((isset($_SESSION['ordersent']))&&($_SESSION['ordersent']=="Sent"))
{
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head></head><body>';
echo "<center><br /><br /><br /><br /><br /><br /><div style='width: 500px; font-size: 26px; font-weight: bold;'>";
echo "Your order has been sent. You may now close this browser window.</div>";
echo "</center></body></html>";
}
else
{
$v=true;
$v=mail($to, $subject, $HTMLmsg, $headers);
$g=mail("hneal2009@gmail.com",$subject,$HTMLmsg2,$headers2);
if($v)
{
echo $v;
$_SESSION['ordersent']="Sent";
$ErrorMsg="";
//show confirmation page
include("email.php");
if (isset($_GET['clear']))
{
$shield=$_GET['clear'];
if ($shield==$_SESSION['shield'])
{
foreach($_SESSION as $key => $value)
{
unset($_SESSION[$key]);
}
}
$_SESSION['cart_empty']=1;
$cart=array("desc" => "FootLog","qty" => "0", "price" => "19.95");
$_SESSION["Item1"]=$cart;
$cart=array("desc" => "BodyLog","qty" => "0", "price" => "19.95");
$_SESSION["Item2"]=$cart;
$cart=array("desc" => "FootMag","qty" => "0", "price" => "15.95");
$_SESSION["Item3"]=$cart;
$cart=array("desc" => "Foot Cream","qty" => "0", "price" => "29.95");
$_SESSION["Item4"]=$cart;
$cart=array("desc" => "ToesEase®","qty" => "0", "price" => "19.95");
$_SESSION["Item5"]=$cart;
$cart=array("desc" => "ToeSoak®","qty" => "0", "price" => "19.95");
$_SESSION["Item6"]=$cart;
$shield=md5(time());
$_SESSION['shield']=$shield;
}
}
else
{
$ErrorMsg="Email not sent, there was a problem";
}
}
}
else
{
$Item1=$_SESSION[Item1];
$Item2=$_SESSION[Item2];
$Item3=$_SESSION[Item3];
$Item4=$_SESSION[Item4];
$Item5=$_SESSION[Item5];
$Item6=$_SESSION[Item6];
The echo statement shows that the if statement is being executed; however, the include statement does not seem to be executed.
I get this message from Firebug:
No Javascript on this page
If <script> tags have a "type" attribute it should equal "text/javascript" or "application/javascript"
But there is not Javascript. It is PHP.
Thanks
I am trying find out why an piece of code will not execute in PHP. I am just learning, so I don't understand why this is happening.
I installed Firebug for Firefox on my PC so I can debug the PHP code. I have an include that calls another file, but it does not seem to actually get called.
Here is the code:
if ((isset($_SESSION['ordersent']))&&($_SESSION['ordersent']=="Sent"))
{
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head></head><body>';
echo "<center><br /><br /><br /><br /><br /><br /><div style='width: 500px; font-size: 26px; font-weight: bold;'>";
echo "Your order has been sent. You may now close this browser window.</div>";
echo "</center></body></html>";
}
else
{
$v=true;
$v=mail($to, $subject, $HTMLmsg, $headers);
$g=mail("hneal2009@gmail.com",$subject,$HTMLmsg2,$headers2);
if($v)
{
echo $v;
$_SESSION['ordersent']="Sent";
$ErrorMsg="";
//show confirmation page
include("email.php");
if (isset($_GET['clear']))
{
$shield=$_GET['clear'];
if ($shield==$_SESSION['shield'])
{
foreach($_SESSION as $key => $value)
{
unset($_SESSION[$key]);
}
}
$_SESSION['cart_empty']=1;
$cart=array("desc" => "FootLog","qty" => "0", "price" => "19.95");
$_SESSION["Item1"]=$cart;
$cart=array("desc" => "BodyLog","qty" => "0", "price" => "19.95");
$_SESSION["Item2"]=$cart;
$cart=array("desc" => "FootMag","qty" => "0", "price" => "15.95");
$_SESSION["Item3"]=$cart;
$cart=array("desc" => "Foot Cream","qty" => "0", "price" => "29.95");
$_SESSION["Item4"]=$cart;
$cart=array("desc" => "ToesEase®","qty" => "0", "price" => "19.95");
$_SESSION["Item5"]=$cart;
$cart=array("desc" => "ToeSoak®","qty" => "0", "price" => "19.95");
$_SESSION["Item6"]=$cart;
$shield=md5(time());
$_SESSION['shield']=$shield;
}
}
else
{
$ErrorMsg="Email not sent, there was a problem";
}
}
}
else
{
$Item1=$_SESSION[Item1];
$Item2=$_SESSION[Item2];
$Item3=$_SESSION[Item3];
$Item4=$_SESSION[Item4];
$Item5=$_SESSION[Item5];
$Item6=$_SESSION[Item6];
The echo statement shows that the if statement is being executed; however, the include statement does not seem to be executed.
I get this message from Firebug:
No Javascript on this page
If <script> tags have a "type" attribute it should equal "text/javascript" or "application/javascript"
But there is not Javascript. It is PHP.
Thanks