Jump to content

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
?>

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.