RE: [PHP] Newbie ?: why this error?
| From: | Jack Dempsey | Date: | Wed, 05 Sep 2001 02:02:06 +0000 |
| Subject: | RE: [PHP] Newbie ?: why this error? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-65976@lists.php.net to get a copy of this message | ||
Hi Vicki,
try this:
<?
if (!$SampFirstName || !$SampLastName || !$SampEmail)
{
echo "You have not entered all the required information. <br>"; #<-- you
need a semi colon here and
echo "Please go back and try again."; #<-- another echo here.
exit;
}
you could also do this:
<?
if (!$SampFirstName || !$SampLastName || !$SampEmail)
{
echo "You have not entered all the required information. <br> Please go back
and try again.";
exit;
}
Jack
-----Original Message-----
From: Vicki [mailto:vickimills@earthlink.net]
Sent: Tuesday, September 04, 2001 9:52 PM
To: php-general@lists.php.net
Subject: [PHP] Newbie ?: why this error?
Not only am I new to PHP, I'm new to programming altogether. I'm trying
to take it step by step, and my first big experiment was the script
below, used to enter info from a form into a mySQL database. I get the
following error message when it runs:
Parse error: parse error, expecting
','' or ';'' in
/www/ideasforimages/request_sample.php on line 8
I've been stuck on this all afternoon. The opening PHP tag is what's on
line 8. I've run other simple scripts with the same tag, so it doesn't
seem to be a problem with the server set-up or application. Any help
would be greatly appreciated!
Vicki
Here's the the first part of the script in question:
<html>
<head>
<title>Sample Request Results</title>
</head>
<body>
<p>Thank you for requesting a sample. Here it is.</p>
<?
if (!$SampFirstName || !$SampLastName || !$SampEmail)
{
echo "You have not entered all the required information. <br>"
"Please go back and try again.";
exit;
}
$SampFirstName = addslashes ($SampFirstName);
$SampLastName = addslashes ($SampLastName) ;
$SampEmail = addslashes ($SampEmail);
$db = mysql_connect ("hostname", "user", "password");
if (!$db)
{
echo "Error: Could not connect to database. Please try again later.";
exit;
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net