Jump to content

Recommended Posts

I used this following script to make a review page.. It didn't work and came up with the following error

 

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>

<body>
<?php   $self = $_POST['PHP_SELF'];
       $name = $_POST['nick'];
 $game = $_POST['game'];
 $review = $_POST['review'];
 
#the html form

$form = "<form action=\"self\" methd=\"post\">";
$form.= "Nick: <input type=\"text\" name=\"nick\" ";
$form.= "size=\"50\" value=\"name\"> <br>";
$form.= "Game: <input type=\"text\" name=\"game\" ";
$form.= "size=\"50\" value=\"game\"> <br>";
$form.= "Review: <br>";
$form.= "textare name=\"review\" cols=\"45\" ";
$form.= "rows=\"4\">$review</textarea> <br>";
$form.= "<input type=\"submit\" name=\"submit\" ";
$form.= "value=\"add\"> </form>";

#on first opening display the form
if( !$submit) { $msg = $form; }

#or redisplay a message and the form if incomplete
else if( !$nick or !$game or !$review)
{ $msg = "<b>Please comlete all fields</b><br><br>";
 $msg.= $form; }
 
#or add the form data to the review database table
else #otherwise connect to mysql
{ $conn = @mysql_connect( "localhost", "sw0rdz", "Mysecret" )
or die( "could not connect to database"; );

#select the database
$rs = @mysql_select_db( "sw0rdz_nintendoplace", $conn )
   or die ( "could no select database" );

#create the sql query
if( $name and $review )
{
$sql ="insert into reviews (nick, game, review)
      values(\"$nick\",\"#$game\",\"review\")";
$rs = @mysql_query( $sql, $conn )
      or die ( "could not execute sql query" ); }
   
#confrim entry and display a link to view review
if ($rs)
{ $msg = "<h3>Thank you - your enty has been saved.";
 $msg.= "<br><a hred =\"index\">";
 $msg.= "Go hom</a></h3>"; }
 
 
}

#write the page
echo( $msg );
?>
   

</body>
</html>

 

the error

Parse error: parse error, unexpected ';' in /usr/home/sw0rdz/domains/nintendoplace.com/public_html/review.php on line 38

 

The page is at

Review

 

 

if its not to hard please help..

Link to comment
https://forums.phpfreaks.com/topic/2182-php-help/
Share on other sites

Check your code where:

#or add the form data to the review database table

else #otherwise connect to mysql

{ $conn = @mysql_connect( "localhost", "sw0rdz", "Mysecret" )

or die( "could not connect to database"; );

 

it should be...

#or add the form data to the review database table

else #otherwise connect to mysql

{ $conn = @mysql_connect( "localhost", "sw0rdz", "Mysecret" )

or die( "could not connect to database" );

 

one too many ";"...

 

-Nate

 

I used this following script to make a review page.. It didn't work and came up with the following error

 

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>

<body>
<?php   $self = $_POST['PHP_SELF'];
       $name = $_POST['nick'];
 $game = $_POST['game'];
 $review = $_POST['review'];
 
#the html form

$form = "<form action=\"self\" methd=\"post\">";
$form.= "Nick: <input type=\"text\" name=\"nick\" ";
$form.= "size=\"50\" value=\"name\"> <br>";
$form.= "Game: <input type=\"text\" name=\"game\" ";
$form.= "size=\"50\" value=\"game\"> <br>";
$form.= "Review: <br>";
$form.= "textare name=\"review\" cols=\"45\" ";
$form.= "rows=\"4\">$review</textarea> <br>";
$form.= "<input type=\"submit\" name=\"submit\" ";
$form.= "value=\"add\"> </form>";

#on first opening display the form
if( !$submit) { $msg = $form; }

#or redisplay a message and the form if incomplete
else if( !$nick or !$game or !$review)
{ $msg = "<b>Please comlete all fields</b><br><br>";
 $msg.= $form; }
 
#or add the form data to the review database table
else #otherwise connect to mysql
{ $conn = @mysql_connect( "localhost", "sw0rdz", "Mysecret" )
or die( "could not connect to database"; );

#select the database
$rs = @mysql_select_db( "sw0rdz_nintendoplace", $conn )
   or die ( "could no select database" );

#create the sql query
if( $name and $review )
{
$sql ="insert into reviews (nick, game, review)
      values(\"$nick\",\"#$game\",\"review\")";
$rs = @mysql_query( $sql, $conn )
      or die ( "could not execute sql query" ); }
   
#confrim entry and display a link to view review
if ($rs)
{ $msg = "<h3>Thank you - your enty has been saved.";
 $msg.= "<br><a hred =\"index\">";
 $msg.= "Go hom</a></h3>"; }
 
 
}

#write the page
echo( $msg );
?>
   

</body>
</html>

 

the error

Parse error: parse error, unexpected ';' in /usr/home/sw0rdz/domains/nintendoplace.com/public_html/review.php on line 38

 

The page is at

Review

if its not to hard please help..

209265[/snapback]

 

Link to comment
https://forums.phpfreaks.com/topic/2182-php-help/#findComment-7182
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.