Page 1 of 1

Clicking a php/access link

Posted: Fri Jan 01, 2010 3:53 am
by bishmedia
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........

Code: Select all

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

NONDESC: Adding a form to HTML output from PHP

Posted: Fri Jan 01, 2010 11:10 am
by omniuni
you probably could just create a form with all the fields hidden, no submit button, and give it an id. Trigger it onclick="" with javascript on the link.

Re: Clicking a php/access link

Posted: Fri Jan 01, 2010 11:23 am
by bishmedia
This is what l came up with a few minutes ago, l just found out about the 'hidden' bit, but I'm havin difficulty assigning the 'sId' to the 'name' via a 'string' etc etc

Any thoughts?

Thanks :-)

Re: Clicking a php/access link

Posted: Sat Jan 02, 2010 6:17 am
by bishmedia
OK at long last l sorted it all l had to do was add in the <a href....> was
<a href="../search/news.php?sid='.$row['sId'].'">

SORTED!!!