Jump to content

ECHO error - Cannot identify the problem


jhc1982

Recommended Posts

Hi Guys,

 

I keep getting the following error:

 

Parse error: syntax error, unexpected T_ECHO in /Applications/XAMPP/xamppfiles/htdocs/pet/petCatalog1.php on line 51

 

I have copied the code from a tutorial and cannot for the life of me work out what the problem is with line 51????

 

I have attached the file and pasted the code below. The real problem line is:

 

 

echo "<tr><td valign='top' width='15%' style='font-weight: bold; font-size: 1.2em'\n"

 

The full code is attached - btw, inserting the ">" does not help to fix it!!

 

<?php

/* Programme: PetCatalog.php

* Desc: Lists all pet categories with radio buttons

*/

?>

 

<html>

<head>

<title>Select a Pet Category</title>

</head>

<body>

 

<?php

/* Database login info - Move to an Include

*/

 

$host="localhost";

$user="root";

$passwd="";

$dbname="information_schema";

 

/* Establishes a connection with the databse

*/

 

$cxn = mysqli_connect ($host, $user, $passwd, $dbname)

or die ("Could not connect to the database JAMIE!");

 

/* SQL Query to select all categories of pet from the petType column in the pet table

*/

 

$query = "SELECT * FROM PetCatalog.petType ORDER BY petType";

$result = mysqli_query($cxn,$query)

or die ("Unable to connect to the database JAMIE");

 

/* Echo of H1 & H2 above the pet table

*/

 

echo "<div style='margin-left: .lin'>\n

<h1 style='text-align: center'>Pet Catalogue</h1>\n

<h2 style='text-align: center'>The following categories of pets are now available</h2>\n";

 

/* Create form to diplay pet categories

*/

 

echo "<form action='ShowPets.php' method='POST'>\n";

echo "<table cellpadding='5' border='1'>";

$counter=1;

while ($row = mysqli_fetch_assoc($result))

{

extract ($row)

echo "<tr><td valign='top' width='15%' style='font-weight: bold; font-size: 1.2em'\n"

echo "<input type='radio' name='interest' value='$petType'\n";

if( $counter == 1 )

{

echo "checked='checked'";

}

echo ">$petType</td>";

echo "<td>$typeDescription</td></tr>";

$counter++;

}

echo "</table>";

echo "<p>input type='submit' value='Select Pet Type'>

</form></p>\n";

 

?>

</body>

</html>

 

[attachment deleted by admin]

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.