I keep getting the following parse error:
Parse error: parse error in /vol/home/wage/public_html/php/handleform1.php on line 177
line 177 is the </html> bit.
The code is as follows
<?php
/* programme: handleform.php
* desc:handles data input generated by form.html
*/
?>
<html>
<head><title>HandleForm</title></head>
<body>
<?php
//Trim incoming data
foreach($array as $key => $val)
{
$array[$key] = trim($val);
}
echo "<table width=\"85%\" border=\"0\">
<tr>";
//check if the "name" field is empty
if($array['name'] == "")
{
echo "you must fill in your name<br /> \n";
}
else //print the result
{
echo "<td width=\"25\"> <strong>Name:</strong> </td>
<td> $array[name] </td>
</tr> \n";
}
//check if the "address" field is empty
if($array['address'] =="")
{
echo "you must fill in your address<br /> \n";
}
else //print the result
{
echo "<tr>
<td valign=\"top\"> <strong>Address: </strong></td>
<td> $array[address] <br /> \n";
}
if ($array[address2] == '') {
// leave blank
} else {
// output
echo "$array[address2]<br /> \n";
}
if ($array[address3] == '') {
// leave blank
} else {
// output
echo "$array[address3]<br /> \n";
}
//check if the "city" field is empty
if($array['city'] =="")
{
echo "you must fill in the city<br /> \n";
}
else
{
echo "$array[city] <br /> \n";
}
//check if the "postcode" field is empty
if($array[postcode] =="")
{
echo "you must fill in the postcode<br />";
}
else
{
echo " $array[postcode]
</td>
</tr> \n";
}
//check if the telephone field is empty
if($array[tel] =="")
{
echo "you must fill in the telephone number<br />";
}
else
{
echo "<tr>
<td><strong>Tel: </strong></td>
<td> $array[tel] </td>
</tr> \n ";
}
//check if fax field is empty
if($array[fax]=='') {
//leave blank
}
else //output
{
echo "<tr>
<td> <strong>Fax: </strong></td>
<td> $array[fax] </td>
</tr> \n";
}
//check if email is empty
if($array=='') {
//leave blank
}
else //output
{
echo "<tr> <td> <strong>Email: </strong></td>
<td> $array[email] </td>
</tr> \n ";
}
//check if the aims are empty
if($array[aims] =="")
{
echo "You must fill in the aims<br />";
}
else {
echo "<tr> <td> <strong>Aims:</strong>:</td>
<td> $array[aims] </td>
</tr> \n";
//check if the activities are empty
if($array[activities] =="")
{
echo "You must fill in the activities<br />";
}
else {
echo "<tr>
<td valign=\"top\"> <strong>Activities:</strong></td>
<td> <ul>
<li>$array[activities] </li> \n";
if ($array[activity2] == '') {
// leave empty
} else {
// output
echo "<li>$array[activity2] </li>";
}
if ($array[activity3] == '') {
// leave empty
} else {
// output
echo "<li>$array[activity3] </li>";
}
if ($array[activity4] == '') {
// leave empty
} else {
// output
echo "<li>$array[activity4] </li>";
}
echo "</ul></td>
</tr>";
//check if the opening_hours are empty
if($array[opening_hours] =="")
{
echo "You must fill in the opening hours<br />";
}
else {
echo"<tr>
<td><strong>Opening Hours:</strong> </td>
<td>$array[opening_hours] </td>
</tr> \n";
}
//check if the referrals are empty
if($array[referral] =="")
{
echo "You must fill in the referral method<br />";
}
else {
echo "<tr>
<td> <strong>Referrals: </strong></td>
<td>$array[referral]</td>
</tr>
</table> \n";
}
?>
</body>
</html>
can anyone help me please?you're missin a few }
//check if the aims are empty
if($array[aims] =="")
{
echo "You must fill in the aims<br />";
}
else {
echo "<tr> <td> <strong>Aims:</strong>:</td>
<td> $array[aims] </td>
</tr> \n";
} // <-------------------------- right here
//check if the activities are empty
if($array[activities] =="")
{
//check if the activities are empty
if($array[activities] =="")
{
echo "You must fill in the activities<br />";
}
else {
echo "<tr>
<td valign=\"top\"> <strong>Activities:</strong></td>
<td> <ul>
<li>$array[activities] </li> \n";
} // <-------------------------- right here
if ($array[activity2] == '') {
// leave empty
and i'm not sure if this is ok... you have the echo out of the else
} else {
// output
echo "<li>$array[activity4] </li>";
}
echo "</ul></td> // <-------------------------- right here
</tr>";
//check if the opening_hours are empty
if($array[opening_hours] =="")
{Yep, if you get a parse error on the last line it normally means you're missing a bracket or two.Thanks Guys
I realised i was missing a couple of }'s after adding them all up.
duh me!
well i'm still new to this, I'm allowed the odd error right?
Parse error: parse error in /vol/home/wage/public_html/php/handleform1.php on line 177
line 177 is the </html> bit.
The code is as follows
<?php
/* programme: handleform.php
* desc:handles data input generated by form.html
*/
?>
<html>
<head><title>HandleForm</title></head>
<body>
<?php
//Trim incoming data
foreach($array as $key => $val)
{
$array[$key] = trim($val);
}
echo "<table width=\"85%\" border=\"0\">
<tr>";
//check if the "name" field is empty
if($array['name'] == "")
{
echo "you must fill in your name<br /> \n";
}
else //print the result
{
echo "<td width=\"25\"> <strong>Name:</strong> </td>
<td> $array[name] </td>
</tr> \n";
}
//check if the "address" field is empty
if($array['address'] =="")
{
echo "you must fill in your address<br /> \n";
}
else //print the result
{
echo "<tr>
<td valign=\"top\"> <strong>Address: </strong></td>
<td> $array[address] <br /> \n";
}
if ($array[address2] == '') {
// leave blank
} else {
// output
echo "$array[address2]<br /> \n";
}
if ($array[address3] == '') {
// leave blank
} else {
// output
echo "$array[address3]<br /> \n";
}
//check if the "city" field is empty
if($array['city'] =="")
{
echo "you must fill in the city<br /> \n";
}
else
{
echo "$array[city] <br /> \n";
}
//check if the "postcode" field is empty
if($array[postcode] =="")
{
echo "you must fill in the postcode<br />";
}
else
{
echo " $array[postcode]
</td>
</tr> \n";
}
//check if the telephone field is empty
if($array[tel] =="")
{
echo "you must fill in the telephone number<br />";
}
else
{
echo "<tr>
<td><strong>Tel: </strong></td>
<td> $array[tel] </td>
</tr> \n ";
}
//check if fax field is empty
if($array[fax]=='') {
//leave blank
}
else //output
{
echo "<tr>
<td> <strong>Fax: </strong></td>
<td> $array[fax] </td>
</tr> \n";
}
//check if email is empty
if($array=='') {
//leave blank
}
else //output
{
echo "<tr> <td> <strong>Email: </strong></td>
<td> $array[email] </td>
</tr> \n ";
}
//check if the aims are empty
if($array[aims] =="")
{
echo "You must fill in the aims<br />";
}
else {
echo "<tr> <td> <strong>Aims:</strong>:</td>
<td> $array[aims] </td>
</tr> \n";
//check if the activities are empty
if($array[activities] =="")
{
echo "You must fill in the activities<br />";
}
else {
echo "<tr>
<td valign=\"top\"> <strong>Activities:</strong></td>
<td> <ul>
<li>$array[activities] </li> \n";
if ($array[activity2] == '') {
// leave empty
} else {
// output
echo "<li>$array[activity2] </li>";
}
if ($array[activity3] == '') {
// leave empty
} else {
// output
echo "<li>$array[activity3] </li>";
}
if ($array[activity4] == '') {
// leave empty
} else {
// output
echo "<li>$array[activity4] </li>";
}
echo "</ul></td>
</tr>";
//check if the opening_hours are empty
if($array[opening_hours] =="")
{
echo "You must fill in the opening hours<br />";
}
else {
echo"<tr>
<td><strong>Opening Hours:</strong> </td>
<td>$array[opening_hours] </td>
</tr> \n";
}
//check if the referrals are empty
if($array[referral] =="")
{
echo "You must fill in the referral method<br />";
}
else {
echo "<tr>
<td> <strong>Referrals: </strong></td>
<td>$array[referral]</td>
</tr>
</table> \n";
}
?>
</body>
</html>
can anyone help me please?you're missin a few }
//check if the aims are empty
if($array[aims] =="")
{
echo "You must fill in the aims<br />";
}
else {
echo "<tr> <td> <strong>Aims:</strong>:</td>
<td> $array[aims] </td>
</tr> \n";
} // <-------------------------- right here
//check if the activities are empty
if($array[activities] =="")
{
//check if the activities are empty
if($array[activities] =="")
{
echo "You must fill in the activities<br />";
}
else {
echo "<tr>
<td valign=\"top\"> <strong>Activities:</strong></td>
<td> <ul>
<li>$array[activities] </li> \n";
} // <-------------------------- right here
if ($array[activity2] == '') {
// leave empty
and i'm not sure if this is ok... you have the echo out of the else
} else {
// output
echo "<li>$array[activity4] </li>";
}
echo "</ul></td> // <-------------------------- right here
</tr>";
//check if the opening_hours are empty
if($array[opening_hours] =="")
{Yep, if you get a parse error on the last line it normally means you're missing a bracket or two.Thanks Guys
I realised i was missing a couple of }'s after adding them all up.
duh me!
well i'm still new to this, I'm allowed the odd error right?