danbob185
06-24-2005, 07:23 AM
Parse error: syntax error, unexpected T_ELSE in c:\program files\apache group\Apache\htdocs\rapidrepair.php on line 78
I keep getting this error in the following script. I know it's a little untidy but I'm very new at this. Also I maxed out the length of the entry?
Please help....
<php if (isset($_GET['addentry'])):
?>
<p align="center" />
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="radio" name="rapid" value="RR001A" />
<input type="radio" name="rapid" value="RR002A" />
<input type="submit" value="submit" /></form>
<?php else:
$dbcnx = @mysql_connect('localhost', 'root', '**********');
if (!$dbcnx) {
exit('<p class="top" />Unable to connect to the ' .
'database server at this time.');
}
if (!@mysql_select_db('rr')) {
exit('<p class="top" />Can't connect to database.');
}
if (isset($_POST['code'])) {
$code = $_POST['code'];
$sql = "INSERT INTO stats SET
code='$code',
repairdate=CURDATE()";
if (@mysql_query($sql)) {
echo '<p class="top" />Entry added';
} else {
echo '<p class="top" />Error, please try again: ' .
mysql_error();
}
}
echo '<p class="top" /><a href="' . $_SERVER['PHP_SELF'] . '?addentry=1">New Entry</a>';
endif;
?>
I keep getting this error in the following script. I know it's a little untidy but I'm very new at this. Also I maxed out the length of the entry?
Please help....
<php if (isset($_GET['addentry'])):
?>
<p align="center" />
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="radio" name="rapid" value="RR001A" />
<input type="radio" name="rapid" value="RR002A" />
<input type="submit" value="submit" /></form>
<?php else:
$dbcnx = @mysql_connect('localhost', 'root', '**********');
if (!$dbcnx) {
exit('<p class="top" />Unable to connect to the ' .
'database server at this time.');
}
if (!@mysql_select_db('rr')) {
exit('<p class="top" />Can't connect to database.');
}
if (isset($_POST['code'])) {
$code = $_POST['code'];
$sql = "INSERT INTO stats SET
code='$code',
repairdate=CURDATE()";
if (@mysql_query($sql)) {
echo '<p class="top" />Entry added';
} else {
echo '<p class="top" />Error, please try again: ' .
mysql_error();
}
}
echo '<p class="top" /><a href="' . $_SERVER['PHP_SELF'] . '?addentry=1">New Entry</a>';
endif;
?>
