Porkie Posted July 6, 2009 Share Posted July 6, 2009 <?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 More sharing options...
seventheyejosh Posted July 6, 2009 Share Posted July 6, 2009 you never close your if isset post statement Link to comment https://forums.phpfreaks.com/topic/164970-problem-with-form-result/#findComment-869872 Share on other sites More sharing options...
seventheyejosh Posted July 6, 2009 Share Posted July 6, 2009 and the semicolons shouldnt be after the { i believe... at least i've never seen that Link to comment https://forums.phpfreaks.com/topic/164970-problem-with-form-result/#findComment-869875 Share on other sites More sharing options...
Maq Posted July 6, 2009 Share Posted July 6, 2009 and the semicolons shouldnt be after the { i believe... at least i've never seen that This occurs multiple times. Don't put semi-colons after IFs. Link to comment https://forums.phpfreaks.com/topic/164970-problem-with-form-result/#findComment-869876 Share on other sites More sharing options...
seventheyejosh Posted July 6, 2009 Share Posted July 6, 2009 <?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 Link to comment https://forums.phpfreaks.com/topic/164970-problem-with-form-result/#findComment-869878 Share on other sites More sharing options...
rhodesa Posted July 6, 2009 Share Posted July 6, 2009 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 ?> Link to comment https://forums.phpfreaks.com/topic/164970-problem-with-form-result/#findComment-869882 Share on other sites More sharing options...
Maq Posted July 6, 2009 Share Posted July 6, 2009 Porkie, maybe you should read some documentation on proper syntax and formatting before you proceed. These are basic syntax errors that you need to be aware of. I would advise learning a good foundation before advancing to anything else. Link to comment https://forums.phpfreaks.com/topic/164970-problem-with-form-result/#findComment-869883 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.