pixeltrace Posted March 11, 2007 Share Posted March 11, 2007 guys, i need help. i have a search form and its working fine. please check http://www.jobhirings.com/new/ if you input keywords on select specialization on the quick search you wont see any error however if i go directly to http://www.jobhirings.com/new/jobsearch/view.php i am getting this error on top of the page Notice: Undefined index: specialization in c:\hosting\webhost4life\member\diorgrace\new\jobsearch\view.php on line 6 Notice: Undefined index: keywords in c:\hosting\webhost4life\member\diorgrace\new\jobsearch\view.php on line 24 this is my code for the view.php page <?php include("../admean/pagina/my_pagina_class.php"); //-for the keywords, specialization condition $cond = ''; if($_POST['specialization'] != ''){ $cond = " AND specialization = '". $_POST['specialization'] ."'"; } //-for the drop down menu if(isset($_GET['sort1']) && $_GET['sort1']!='') $sort1 = $_GET['sort1']; else $sort1 = "j_position"; if(isset($_GET['sort2']) && $_GET['sort2']!='') $sort2 = $_GET['sort2']; else $sort2 = "ASC"; //- $test = new JHpage; $test->sql = "SELECT * FROM job_ads WHERE j_status ='open' AND j_position LIKE '%". $_POST['keywords'] ."%'".$cond." ORDER BY ".$sort1 ." ".$sort2.""; // the (basic) sql statement (use the SQL whatever you like) $result = $test->get_page_result(); // result set $num_rows = $test->get_page_num_rows(); // number of records in result set $nav_links = $test->navigation(" | ", "currentStyle"); // the navigation links (define a CSS class selector for the current link) $nav_info = $test->page_info(); // information about the number of records on page ("to" is the text between the number) $simple_nav_links = $test->back_forward_link(true); // the navigation with only the back and forward links, use true to use images $total_recs = $test->get_total_rows(); // the total number of records ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>:: Job HiRings - Contact Us ::</title> <style type="text/css"> <!-- body { background-image: url(../images/main/bg.gif); } --> </style> <link href="../css.css" rel="stylesheet" type="text/css"> <script type="text/JavaScript"> <!-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //--> </script> </head> <body> <table width="776" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><table width="776" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="3" valign="top"><img src="../images/main/top.gif" width="776" height="6"></td> </tr> <tr> <td width="6" align="left" valign="top" background="../images/main/left.gif"><img src="../images/main/left.gif" width="6" height="14"></td> <td width="764" bgcolor="#FFFFFF"><table width="764" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="2" valign="top"><img src="../images/contactus/flashmenu.gif" width="764" height="54"></td> </tr> <form method="post" action="view.php" name="searchform"><tr> <td width="525" valign="top" height="159"><img src="../images/job/flash03.gif" width="525" height="159"></td> <td width="239" valign="top"> <!--start of search form--> <table width="239" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr> <td colspan="4" valign="top"><img src="../images/contactus/subquickjob01.gif" width="239" height="32"></td> </tr> <tr> <td width="8" rowspan="8" align="left" background="../images/aboutus/subquickjob02.gif"><img src="../images/contactus/subquickjob02.gif" width="8" height="112"></td> <td colspan="2" valign="top" class="text1"><img src="../images/spacer.gif" width="10" height="4"></td> <td width="5" rowspan="8" align="right" background="../images/contactus/subquickjob03.gif"><img src="../images/contactus/subquickjob03.gif" width="5" height="112"></td> </tr> <tr> <td colspan="2" class="text1"> Keywords</td> </tr> <tr> <td colspan="2" align="right"><input name="keywords" type="text" class="field2"> </td> </tr> <tr> <td colspan="2" align="right" valign="top"><span class="text1"><img src="../images/main/spacer.gif" width="1" height="1"></span></td> </tr> <tr> <td colspan="2" class="text1"> Job Specialization </td> </tr> <tr> <td colspan="2" align="right"> <select name="specialization" class="field3"> <option value="">All</option> <? include '../admean/db_connect.php'; $uSql = "SELECT specialization FROM specialization"; $uResult = mysql_query($uSql, $connection); if(!$uResult){ echo 'no data found'; }else{ while($uRow = mysql_fetch_row($uResult)){ ?> <option value="<?= $uRow[0]?>"><?= $uRow[0]?></option> <? } } ?> </select> </td> </tr> <tr> <td colspan="2" align="right" valign="top"><img src="../images/main/spacer.gif" width="1" height="1"></td> </tr> <tr> <td width="155"> <a href="advancedsearch.php" class="link1">advanced search</a> </td> <td width="71" align="right"><input name="Submit2" type="submit" class="button1" value="Search"> </td> </tr> <tr> <td colspan="4" valign="top"><img src="../images/contactus/subquickjob04.gif" width="239" height="15"></td> </tr> </table> <!--end of search form--> </td> </tr></form> <tr> <td height="62" colspan="2" align="left" valign="top" bgcolor="#FFFFFF"><table width="764" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="181" valign="top" background="../images/contactus/middlebar03.gif"> </td> <td width="344" valign="top"><img src="../images/contactus/middlebar02.gif" width="344" height="50"></td> <td width="239" background="../images/contactus/middlebar03.gif"> </td> </tr> <tr> <td colspan="3" valign="top"> </td> </tr> <tr> <td colspan="3" align="center" valign="top"> <table width="755" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="6"><img src="../admean/images/spacer.gif" width="6" height="10"></td> <td width="743" class="text9"><table width="216" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="3" valign="top" bgcolor="#666666"><img src="../admean/job/images/spacer.gif" width="1" height="1"></td> </tr> <tr> <td align="left" bgcolor="#666666" width="1"><img src="../admean/job/images/spacer.gif" width="1" height="1"></td> <td width="214" valign="top"><table width="741" border="0" cellspacing="2" cellpadding="0"> <tr> <td colspan="5"><form method="get" action="view.php"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="450"><span class="text6"> <?php echo " total record found: " .$total_recs; ?> </span></td> <td width="287" align="right" class="text6"><span class="text7">sort by :</span> <select name="sort1"> <option value="j_position">Position</option> <option value="location">Location</option> <option value="date_posted">Date Posted</option> </select> <select name="sort2"> <option value="ASC">ASC</option> <option value="DESC">DESC</option> </select> <input type="submit" name="Submit" value="Go" /> </td> </tr> </table> </form> </td> </tr> <tr> <td colspan="5"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="60%" align="left" class="text8"> </td> <td width="39%" align="right"><!-- nav top --> <? echo "<span class='link1'>".$nav_links."</span>"; ?> </td> <td width="1%" align="right"><img src="../image/spacer.gif" width="1" height="1" /></td> </tr> </table></td> </tr> <tr> <td width="78" bgcolor="950101" class="text9"> Date</td> <td width="212" valign="top" bgcolor="950101" class="text9"> Position </td> <td width="243" bgcolor="950101" class="text9"> Company </td> <td width="198" colspan="2" bgcolor="950101" class="text5"> <span class="text9">Location</span></td> </tr> <?php for ($i = 0; $i < $num_rows; $i++) { $date_posted = mysql_result($result, $i, "date_posted"); $jobid = mysql_result($result, $i, "jobid"); $j_position = mysql_result($result, $i, "j_position"); $c_name = mysql_result($result, $i, "c_name"); $location = mysql_result($result, $i, "location"); ?> <tr> <td bgcolor="#e5e5e5" class="text4"> <? echo "$date_posted"; ?></td> <td bgcolor="#e5e5e5"> <a href="javascript:;" class="link1" onClick="MM_openBrWindow('jobpost.php?jobid=<? echo "$jobid"; ?>','','scrollbars=yes,width=720,height=700')"><? echo "$j_position";?></a></td> <td bgcolor="#e5e5e5" class="text4"> <? echo "$c_name";?> </td> <td bgcolor="#e5e5e5" class="text4"> <? echo "$location";?> </td> </tr> <? } ?> <tr> <td colspan="5" bgcolor="#950101"><img src="../admean/images/spacer.gif" width="10" height="2" /></td> </tr> <tr> <td colspan="5"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="60%" align="left" class="text8"> </td> <td width="39%" align="right"><!-- nav top --> <? echo "<span class='link1'>".$nav_links."</span>"; ?> </td> <td width="1%" align="right"><img src="../image/spacer.gif" width="1" height="1" /></td> </tr> </table></td> </tr> </form> <tr> <td colspan="5"> </td> </tr> </table></td> <td align="right" bgcolor="#666666" width="1"><img src="../admean/job/images/spacer.gif" width="1" height="1"></td> </tr> <tr> <td colspan="3" valign="top" bgcolor="#666666"><img src="../admean/job/images/spacer.gif" width="1" height="1"></td> </tr> </table></td> <td width="10"><img src="../admean/images/spacer.gif" width="6" height="10"></td> </tr> </table> </td> </tr> <tr> <td colspan="3" valign="top"> </td> </tr> </table></td> </tr> <tr> <td colspan="2" valign="top" style="background:url(../images/main/footer.gif); background-repeat:no-repeat"> <? include '../footer.php'; ?> </td> </tr> </table></td> <td width="6" background="../images/main/right.gif" align="right"><img src="../images/main/right.gif" width="6" height="3"></td> </tr> <tr> <td colspan="3" valign="bottom"><img src="../images/main/bottom.gif" width="776" height="8"></td> </tr> </table></td> </tr> </table> </body> </html> hope you could help me with this. thanks a lot! Link to comment https://forums.phpfreaks.com/topic/42199-solved-need-help-on-my-view-page/ Share on other sites More sharing options...
trq Posted March 11, 2007 Share Posted March 11, 2007 You need to make sure $_POST['specialization'] actually exists before trying to use it. $cond = ''; if (isset($_POST['serialization'])) { if($_POST['specialization'] != ''){ $cond = " AND specialization = '". $_POST['specialization'] ."'"; } } Link to comment https://forums.phpfreaks.com/topic/42199-solved-need-help-on-my-view-page/#findComment-204700 Share on other sites More sharing options...
pixeltrace Posted March 11, 2007 Author Share Posted March 11, 2007 its working fine now thanks! Link to comment https://forums.phpfreaks.com/topic/42199-solved-need-help-on-my-view-page/#findComment-204707 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.