Jump to content

Recommended Posts

<?
session_name('usersession');
session_start();
?>

<html>
<head>
<title>Equine Revolution's Equine Registry</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>

<body>
<center>
<table id="main">
<tr><td>
<p><h1>Register A Horse</h1>
<?
if(!isset($peacock))
{
include('menu2.php');
include('loginform.php');

exit();
}

else {
include('menu1.php'); 
echo "

<p>
<form action="insert.php" method="post">
Name: <input type="text" name="name" /> <br>
Age: <input type="text" name="age" /> <br>
Breed: <input type="text" name="breed" /> <br>
Color: <input type="text" name="color" /> <br>
Height: <input type="text" name="height" /> <br>
Gender: <input type="text" name="gender" /> <br>
Sire: <input type="text" name="sire" /> <br>
Sire's Sire: <input type="text" name="siresire" /> <br>
Sire's Dam: <input type="text" name="siredam" /> <br>
Dam: <input type="text" name="dam" /> <br>
Dam's Sire: <input type="text" name="damsire" /> <br>
Dam's Dam: <input type="text" name="damdam" /> <br>
Owner: <input type="text" name="owner" /> <br>
Origins: <input type="text" name="origins" /> <br>
Type: <input type="text" name="type" /> <br>
<input type="submit" />
</form>
</p>;
}
?>

<p>
<?
include('foot.php');
?>
</p>
</td></tr>

<tr><td></td></tr>

</table>
</center>

</body>
</html> 

 

Error:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/www/erregistry.awardspace.us/register.php on line 31

<?
session_name('usersession');
session_start();
?>

<html>
<head>
<title>Equine Revolution's Equine Registry</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>

<body>
<center>
<table id="main">
<tr><td>
<p><h1>Register A Horse</h1>
<?
if(!isset($peacock))
{
include('menu2.php');
include('loginform.php');

exit();
}

else {
include('menu1.php'); 
echo '

<p>
<form action="insert.php" method="post">
Name: <input type="text" name="name" /> <br>
Age: <input type="text" name="age" /> <br>
Breed: <input type="text" name="breed" /> <br>
Color: <input type="text" name="color" /> <br>
Height: <input type="text" name="height" /> <br>
Gender: <input type="text" name="gender" /> <br>
Sire: <input type="text" name="sire" /> <br>
Sire's Sire: <input type="text" name="siresire" /> <br>
Sire's Dam: <input type="text" name="siredam" /> <br>
Dam: <input type="text" name="dam" /> <br>
Dam's Sire: <input type="text" name="damsire" /> <br>
Dam's Dam: <input type="text" name="damdam" /> <br>
Owner: <input type="text" name="owner" /> <br>
Origins: <input type="text" name="origins" /> <br>
Type: <input type="text" name="type" /> <br>
<input type="submit" />
</form>
</p>';
}
?>

<p>
<?
include('foot.php');
?>
</p>
</td></tr>

<tr><td></td></tr>

</table>
</center>

</body>
</html> 

 

You were using echo with double-quotations and then using double-quotations for all of your form/html stuff. You also did not end your echo. Copy the code above, changed echo " to echo ' and also put the last ' before your semicolon.

Here is the updated code that I fixed:

 

<?
session_name('usersession');
session_start();
?>

<html>
<head>
<title>Equine Revolution's Equine Registry</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>

<body>
<center>
<table id="main">
<tr><td>
<p><h1>Register A Horse</h1>
<?
if(!isset($peacock))
{
include('menu2.php');
include('loginform.php');

exit();
}

else {
include('menu1.php'); 
echo '

<p>
<form action='insert.php' method='post'>
Name: <input type='text' name='name' /> <br>
Age: <input type='text' name='age' /> <br>
Breed: <input type='text' name='breed' /> <br>
Color: <input type='text' name='color' /> <br>
Height: <input type='text' name='height' /> <br>
Gender: <input type='text' name='gender' /> <br>
Sire: <input type='text' name='sire' /> <br>
Sire's Sire: <input type='text' name='siresire' /> <br>
Sire's Dam: <input type='text' name='siredam' /> <br>
Dam: <input type='text' name='dam' /> <br>
Dam's Sire: <input type='text' name='damsire' /> <br>
Dam's Dam: <input type='text' name='damdam' /> <br>
Owner: <input type='text' name='owner' /> <br>
Origins: <input type='text' name='origins' /> <br>
Type: <input type='text' name='type' /> <br>
<input type='submit' />
</form>
</p>';
}
?>

<p>
<?
include('foot.php');
?>
</p>
</td></tr>

<tr><td></td></tr>

</table>
</center>

</body>
</html> 

 

And I'm still getting the same error:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/www/erregistry.awardspace.us/register.php on line 31

When you use echo, you have to use either single quotes or double quotes. So  Echo 'Hello' or echo "Hello".

Take the follow sentence for example. John said, "Hello, my name is John". You would use echo with single quotes. echo ' John said, "Hello, my name is John".'; If you used double quotes, you would be ending the end of the echo. Hope that makes sense:)

Ok, I removed the ' from Sire's and now it's working :) Thanks.

 

I also have this page:

<?
session_name('usersession');
session_start();

include ('db1.php');

$query = "SELECT * FROM registry WHERE owner='$user' ORDER BY id "; 
$result = mysql_query($query) or die(mysql_error()); 
?>

<html>
<head>
<title>Equine Revolution's Equine Registry</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>

<body>
<center>
<table id="main">
<tr><td>
<p><h1>My Horses</h1>
<br>


<?
if(!isset($peacock))
{
include('menu2.php');
include('loginform.php');

exit();
}

else {
include('menu1.php'); 
echo '<br>
<?
while($row= mysql_fetch_array($result)) {

$id = $row[id];
$name = $row[name];
$age = $row[age];
$breed = $row[breed];
$color = $row[color];
$gender = $row[gender];
?> 

<? echo $id ?> 
<a href= 'view.php?id=<? echo $id ?>'><? echo $name ?> 
</a> <? echo $age ?> 
<? echo $color ?> 
<? echo $breed ?> 
<? echo $gender ?> <br>
<?}?>
'}
?>

</p>

<p>
<?
include('foot.php');
?>
</p>
</td></tr>

<tr><td></td></tr>

</table>
</center>

</body>
</html> 

 

and it comes up with the same Parse error:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/www/erregistry.awardspace.us/myhorses.php on line 49

Change all of this:

else {
include('menu1.php'); 
echo '<br>
<?
while($row= mysql_fetch_array($result)) {

$id = $row[id];
$name = $row[name];
$age = $row[age];
$breed = $row[breed];
$color = $row[color];
$gender = $row[gender];
?> 

<? echo $id ?> 
<a href= 'view.php?id=<? echo $id ?>'><? echo $name ?> 
</a> <? echo $age ?> 
<? echo $color ?> 
<? echo $breed ?> 
<? echo $gender ?> <br>
<?}?>
'}
?>

 

to this:

else {
include('menu1.php'); 
echo '<br /';
while($row= mysql_fetch_array($result)) 
{

$id = $row[id];
$name = $row[name];
$age = $row[age];
$breed = $row[breed];
$color = $row[color];
$gender = $row[gender];

echo $id . "<a href='view.php?id=$id'>$name</a><br />";
echo $age . "<br />";
echo $color . "<br />";
echo $breed . "<br />";
echo $gender . "<br> />";
}
?>

OK.

I changed it to that but I noticed breaks after each line. I want it to be one continue line, with a break at the end, after the "gender" only.

 

So it now reads:

<?
session_name('usersession');
session_start();

include ('db1.php');

$query = "SELECT * FROM registry WHERE owner='$user' ORDER BY id "; 
$result = mysql_query($query) or die(mysql_error()); 
?>

<html>
<head>
<title>Equine Revolution's Equine Registry</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>

<body>
<center>
<table id="main">
<tr><td>
<p><h1>My Horses</h1>
<br>


<?
if(!isset($peacock))
{
include('menu2.php');
include('loginform.php');

exit();
}

else {
include('menu1.php');
echo '<br /';
while($row= mysql_fetch_array($result))
{

   $id = $row[id];
   $name = $row[name];
   $age = $row[age];
   $breed = $row[breed];
   $color = $row[color];
   $gender = $row[gender];
   
   echo $id . "<a href='view.php?id=$id'>$name</a><br />";
   echo $age . "<br />";
   echo $color . "<br />";
   echo $breed . "<br />";
   echo $gender . "<br> />";
}
?>

</p>

<p>
<?
include('foot.php');
?>
</p>
</td></tr>

<tr><td></td></tr>

</table>
</center>

</body>
</html> 

 

and I get an unexpected $end error on line 70.

Parse error: syntax error, unexpected $end in /home/www/erregistry.awardspace.us/myhorses.php on line 70

<?
session_name('usersession');
session_start();

include ('db1.php');

$query = "SELECT * FROM registry WHERE owner='$user' ORDER BY id "; 
$result = mysql_query($query) or die(mysql_error()); 
?>

<html>
<head>
<title>Equine Revolution's Equine Registry</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>

<body>
<center>
<table id="main">
<tr><td>
<p><h1>My Horses</h1>
<br>


<?
if(!isset($peacock))
{
include('menu2.php');
include('loginform.php');

exit();
}

else {
include('menu1.php');
echo '<br />';
while($row= mysql_fetch_array($result))
{

   $id = $row[id];
   $name = $row[name];
   $age = $row[age];
   $breed = $row[breed];
   $color = $row[color];
   $gender = $row[gender];
   
   echo $id . "<a href='view.php?id=$id'>$name</a>" . $age . $color . $breed . $gender . "<br> />";
}
?>
</p>

<p>
<?
include('foot.php');
?>
</p>
</td></tr>

<tr><td></td></tr>

</table>
</center>

</body>
</html> 

 

That's the newest version of the code. I put it in and it says 'unexpected $end on line 65'. I counted down. There is no line 65.

Line 48, you need another bracket.

   echo $id . "<a href='view.php?id=$id'>$name</a>" . $age . $color . $breed . $gender . "<br> />";
}

 

needs to be:

 

   echo $id . "<a href='view.php?id=$id'>$name</a>" . $age . $color . $breed . $gender . "<br> />";
}
}

 

You were missing a closing bracket from your else statement.

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.