contraboybish Posted January 1, 2010 Share Posted January 1, 2010 OK l have a page called 'SEARCH', someone enters a word and a list of news items appear as below. What l would like to do is click on one of the links and have it open in a new page called 'NEWS' Somehow i need to build a simple form in the code below and have the 'sId' as the link name and on the 'NEWS' page use the '$_POST' again to 'SELECT' the correct record. Here is my code........ <?php require_once('../App_Data/odbc_open.php'); $result = odbc_exec($odbc, "SELECT * FROM Search WHERE (sKeyword1 LIKE '%$_POST[item_search]%')"); echo "Results For <b>$_POST[item_search]</b>"; echo "<table width='910' border='0' align='center'>"; while($row = odbc_fetch_array($result)) { echo '<tr style="text-align:justify">'; echo '<td valign="top">'; echo '<img src="../'.$row['sImages'].' " width="'.$row['sImageWidth'].'" height="'.$row['sImageHeight'].'" alt="'.$row['sAlt'].'"hspace="8" vspace="8" align="right"/>'; echo '<div><a href="'.$row['sId'].'" class="smallLinks" > '.$row['sHeading'].'</a><br /></div>'; echo '<div class="style2" style="text-align:justify">'.$row['sDescription'].'<br /></div>'; echo '<div class="smalldate">Date: '.$row['sDate'].'</div>'; echo '<br />'; echo '</td>'; echo '</tr>'; } echo "</table>"; ?> Any thoughts anyone.... Many Thanks Quote Link to comment Share on other sites More sharing options...
RussellReal Posted January 1, 2010 Share Posted January 1, 2010 sorry I didn't understand your post? You want like suggestions at the bottom of your search box? Quote Link to comment Share on other sites More sharing options...
contraboybish Posted January 1, 2010 Author Share Posted January 1, 2010 On the site you search for a word and that brings up a list of different news reviews, at the moment, when you click on a link it brings up that news page. http://www.logisticsbusiness.com/Magazine/search.aspx I currently have thousands of News pages and all l want now is to open one e.g. 'NEWS.PHP' and have the data in the MS Access instead...... Hope this makes sense!!!! Quote Link to comment Share on other sites More sharing options...
contraboybish Posted January 1, 2010 Author Share Posted January 1, 2010 There must be away of doing this? Just getting the 'sId' data to the 'News' page would help :-( Anyone Quote Link to comment Share on other sites More sharing options...
RussellReal Posted January 2, 2010 Share Posted January 2, 2010 I've never worked with MS access so I have no idea.. but if by sId you mean "session id" then you could simply get it with session_id() Sorry if I'm not helping much.. Quote Link to comment Share on other sites More sharing options...
mapleleaf Posted January 2, 2010 Share Posted January 2, 2010 <a href="'.$row['sId'] looks like not enough info for a url. What is your output on the page so we can see the error. seems you need <a href="news.php?sid='.$row['sId'].'"> Something along those lines assuming you are using $_GET Quote Link to comment Share on other sites More sharing options...
contraboybish Posted January 2, 2010 Author Share Posted January 2, 2010 mapleleaf You are on the right road l think <a href="news.php?sid='.$row['sId'].'"> This would open the news.php page and select the 'sId' record assigned to the string 'sid' by using $_GET or $_POST .... I'm gonna try it now!!!! Quote Link to comment Share on other sites More sharing options...
contraboybish Posted January 2, 2010 Author Share Posted January 2, 2010 It worked, l replaced it with <a href="news.php?sid='.$row['sId'].'"> and the news page came up with the 'sId' record using $_GET[sid] Many many thanks :-) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.