Jump to content

[SOLVED] "Parse Error , syntax error , unexpected T_VARIABLE"


munky334

Recommended Posts

Hi there

 

I'm getting the following error when trying to run this script and I have no idea , any advise?

 

"Parse Error , syntax error , unexpected T_VARIABLE" - Line 19

 

I'm using PHP 5.2.6 together with wampserver.

<?php
/* File: shop_form_shipinfo.inc
* Desc: Contains the code for a form that collects
* shipping information for the order.
*/
include("functions.inc"); 
include("Vars.inc"); 
$ship_info = array("email" => "Email Address", 
"ship_name" => "Name",
"ship_street" => "Street",
"ship_city" => "City",
"ship_state" => "State",
"ship_zip" => "Zip",
"phone" => "Phone",
"cc_type" => "Credit Card Type",
"cc_number" => "Credit Card Number",
"cc_exp" => "Expiration Date"
)
$cc_types = array("visa" => "Visa", 
"mc" => "Master Card",
"amex" => "American Express"
);
$length = array("email" => "55", 
"ship_name" => "40",
"ship_street" => "55",
"ship_city" => "40",
"ship_zip" => "10",
"phone" => "15",
"cc_number" => "20"
);
$months = array (1=> "January", "February", "March", 
"April", "May", "June", "July",
"August", "September",
"October", "November", "December"
);
$today = time("Y-m-d"); 
if(!isset($_POST) or 
$_POST['Ship'] == "Edit Shipping Information" )
{
$cxn = mysqli_connect($host,$user,$passwd,$database); 
$sql = "SELECT
ship_name,ship_street,ship_city,ship_state,
ship_zip,phone,email FROM CustomerOrder WHERE
order_number = '{$_SESSION['order_number']}'";
$result = mysqli_query($cxn,$sql)
or die("Error: ".mysqli_error($cxn));
$n = mysqli_num_rows($result); 
if($n > 0) 
{
$row = mysqli_fetch_assoc($result);
extract($row);
}
} 
?>
<head><title>Furniture Order: Shipping Information</title>
<style type="text/css">
<!--
#form {
margin: 1.5em 0 0 0;
padding: 0;
}
#field {padding-bottom: 1em;}
label {
font-weight: bold;
float: left;
width: 20%;
text-align: right;
clear: left;
margin-right; 1em;
}
-->
</style>
</head> 
<h2 align='center'>Furniture Shop: Shipping Information</h2>
<p style='font-style: italic;
font-weight: bold'>Please fill in the information below
<?php
echo "<form action='$_SERVER[php_SELF]’ method=’POST’> 
<div id=’form’>\n";
if(isset($message)) 
{
echo "<p style=\"font-weight: bold; font-style: italic;
font-size: 90%; color: red\">
$message</p>";
}
foreach($ship_info as $field => $value) 
{
if($field == "ship_state”) 
{
echo "<div id=’field’>
<label for '$field’>State: </label>
<select name=’$field’ id=$field>”;
$stateName=getStateName(); 
$stateCode=getStateCode();
for ($n=1;$n<=50;$n++)
{
$state=$stateName[$n];
$scode=$stateCode[$n];
echo "<option value=’$scode’”;
if($scode == @$_POST['state’] ||
$scode == @$ship_state)
echo " selected";
echo ">$state\n";
}
echo "</select></div>";
}
elseif($field == "cc_type") 
{
echo "<div id='field'>
<label for '$field'>$value: </label>
<select name=’cc_type'></p>”;
foreach($cc_types as $field => $value)
{
echo "<option value='$field'";
echo ">$value\n";
}
echo "</select></div>";
}
elseif($field == "cc_exp") 
{
echo "<div id='field'>
<label for '$field'>$value: </label>
<select name='cc_exp_mo'></p>";
for($n=1;$n<=12;$n++)
{
echo "<option
value='$n'>{$months[$n]}\n";
}
echo "</select>\n";
echo "<select name='cc_exp_da'>";
for($n=1;$n<=31;$n++)
{
echo " <option value='$n'>$n\n";
}
echo "</select>\n";
echo "<select name='cc_exp_yr'>";
$start_yr = date("Y",$today);
for($n=$start_yr;$n<=$start_yr+5;$n++)
{
echo " <option value='$n'>$n\n";
}
echo "</select></div>\n";
}
else 
{
echo "<div id='field'>
<label for='$field'>$value: </label>
<input type='text' id='$field' name='$field'
value='".@$$field."'
size='{$length[$field]}'
maxsize='{$length[$field]}' />
</div>\n";
}
}
?>
<p style="margin-top: .05in"> 
<input style='margin-left: 33%' type="submit"
name="Summary" value="Continue" />
</form></body></html>

Link to comment
Share on other sites

<?php
/* File: shop_form_shipinfo.inc
* Desc: Contains the code for a form that collects
* shipping information for the order.
*/
include("functions.inc");
include("Vars.inc");
$ship_info = array("email" => "Email Address",
"ship_name" => "Name",
"ship_street" => "Street",
"ship_city" => "City",
"ship_state" => "State",
"ship_zip" => "Zip",
"phone" => "Phone",
"cc_type" => "Credit Card Type",
"cc_number" => "Credit Card Number",
"cc_exp" => "Expiration Date"
);
$cc_types = array("visa" => "Visa",
"mc" => "Master Card",
"amex" => "American Express"
);
$length = array("email" => "55",
"ship_name" => "40",
"ship_street" => "55",
"ship_city" => "40",
"ship_zip" => "10",
"phone" => "15",
"cc_number" => "20"
);
$months = array (1=> "January", "February", "March",
"April", "May", "June", "July",
"August", "September",
"October", "November", "December"
);
$today = time("Y-m-d");
if(!isset($_POST) or
$_POST['Ship'] == "Edit Shipping Information" )
{
$cxn = mysqli_connect($host,$user,$passwd,$database);
$sql = "SELECT
ship_name,ship_street,ship_city,ship_state,
ship_zip,phone,email FROM CustomerOrder WHERE
order_number = '{$_SESSION['order_number']}'";
$result = mysqli_query($cxn,$sql)
or die("Error: ".mysqli_error($cxn));
$n = mysqli_num_rows($result);
if($n > 0)
{
$row = mysqli_fetch_assoc($result);
extract($row);
}
}
?>
<head><title>Furniture Order: Shipping Information</title>
<style type="text/css">
<!--
#form {
margin: 1.5em 0 0 0;
padding: 0;
}
#field {padding-bottom: 1em;}
label {
font-weight: bold;
float: left;
width: 20%;
text-align: right;
clear: left;
margin-right; 1em;
}
-->
</style>
</head>
<h2 align='center'>Furniture Shop: Shipping Information</h2>
<p style='font-style: italic;
font-weight: bold'>Please fill in the information below
<?php
echo "<form action='$_SERVER[php_SELF]’ method=’POST’>
<div id=’form’>\n";
if(isset($message))
{
echo "<p style=\"font-weight: bold; font-style: italic;
font-size: 90%; color: red\">
$message</p>";
}
foreach($ship_info as $field => $value)
{
if($field == "ship_state”)
{
echo "<div id=’field’>
<label for '$field’>State: </label>
<select name=’$field’ id=$field>”;
$stateName=getStateName();
$stateCode=getStateCode();
for ($n=1;$n<=50;$n++)
{
$state=$stateName[$n];
$scode=$stateCode[$n];
echo "<option value=’$scode’”;
if($scode == @$_POST['state’] ||
$scode == @$ship_state)
echo " selected";
echo ">$state\n";
}
echo "</select></div>";
}
elseif($field == "cc_type")
{
echo "<div id='field'>
<label for '$field'>$value: </label>
<select name=’cc_type'></p>”;
foreach($cc_types as $field => $value)
{
echo "<option value='$field'";
echo ">$value\n";
}
echo "</select></div>";
}
elseif($field == "cc_exp")
{
echo "<div id='field'>
<label for '$field'>$value: </label>
<select name='cc_exp_mo'></p>";
for($n=1;$n<=12;$n++)
{
echo "<option
value='$n'>{$months[$n]}\n";
}
echo "</select>\n";
echo "<select name='cc_exp_da'>";
for($n=1;$n<=31;$n++)
{
echo " <option value='$n'>$n\n";
}
echo "</select>\n";
echo "<select name='cc_exp_yr'>";
$start_yr = date("Y",$today);
for($n=$start_yr;$n<=$start_yr+5;$n++)
{
echo " <option value='$n'>$n\n";
}
echo "</select></div>\n";
}
else
{
echo "<div id='field'>
<label for='$field'>$value: </label>
<input type='text' id='$field' name='$field'
value='".@$$field."'
size='{$length[$field]}'
maxsize='{$length[$field]}' />
</div>\n";
}
}
?>
<p style="margin-top: .05in">
<input style='margin-left: 33%' type="submit"
name="Summary" value="Continue" />
</form></body></html> 

 

try this

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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