Jump to content

problem with form result


Porkie

Recommended Posts

<?php
$con = mysql_connect("");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("", $con);


if (isset($_POST['Submit'])) {;
$search = $_POST['search'];
$dropdown1 = $_POST['dropdown1'];

if ($dropdown1=="Getting Started");
  {
echo "www.abgs.com/Help.php";
  }
  
  if ($dropdown1=="Category");
  {
  echo "<a href='video.php?category=$search'><h1>{$video['$search']}</h1></a>";
  }
?>

 

it says i have an error however im confused where the error is ?

 

 

Parse error: syntax error, unexpected $end in /home/abc/public_html/Newdirectory/Result.php on line 25

 

i want it to take you straight to the websitepage.Instead of a link, will this work?

 

cheers in advance

Link to comment
https://forums.phpfreaks.com/topic/164970-problem-with-form-result/
Share on other sites

<?php
$con = mysql_connect("");
if (!$con){
  die('Could not connect: ' . mysql_error());
  }//end if

mysql_select_db("", $con);


if (isset($_POST['Submit'])) {
   $search = $_POST['search'];
   $dropdown1 = $_POST['dropdown1'];

if ($dropdown1=="Getting Started"){
echo "www.abgs.com/Help.php";
}//end if
  
if ($dropdown1=="Category"){
	 echo "<a href='video.php?category=$search'><h1>{$video['$search']}</h1></a>";
  	}//end if

}//end if
?>

 

edit: forgot my

's

yeah, remove the semi-colons from the IF statement lines and you were missing a close brace. try indenting your code...if you do that properly, it's very easy to find missing braces:

 

<?php
  $con = mysql_connect("");
  if (!$con)
  {
    die('Could not connect: ' . mysql_error());
  }

  mysql_select_db("", $con);


  if (isset($_POST['Submit'])) //Removed semi-colon here
  {
    $search = $_POST['search'];
    $dropdown1 = $_POST['dropdown1'];

    if ($dropdown1=="Getting Started") //Removed semi-colon here
    {
      echo "www.abgs.com/Help.php";
    }
  
    if ($dropdown1=="Category") //Removed semi-colon here
    {
      echo "<a href='video.php?category=$search'><h1>{$video['$search']}</h1></a>";
    }
  } //This was missing
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.