jr8rdt Posted May 31, 2007 Share Posted May 31, 2007 I would like to have link on all my server_id and when I click it I should go to a new page carrying with me the id this is what I did. and when I click on the id link I don't get anything ( the page was not redirected) help! SCRIPT language="JavaScript"> function submitform() { document.myform.submit(); } </SCRIPT> include 'db_connect.php'; $query = "SELECT * FROM server ORDER BY server_id"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $id1 = "{$row['server_id']}"; echo "<tr>"; echo "<form name='send1' action='modify.php'>"; echo "<input type='hidden' name='id1' value='$id1'>"; echo " <td><a href='javascript: submitform()'> {$row['server_id']} </a></td>"; echo "</form>"; Link to comment https://forums.phpfreaks.com/topic/53799-solved-javascritp-and-php-submit-form/ Share on other sites More sharing options...
fenway Posted June 1, 2007 Share Posted June 1, 2007 You just want to redirect? Link to comment https://forums.phpfreaks.com/topic/53799-solved-javascritp-and-php-submit-form/#findComment-266255 Share on other sites More sharing options...
jr8rdt Posted June 1, 2007 Author Share Posted June 1, 2007 the code will display whole bunch of records with server_id (id) . I want to be able to click the server_id (id) and go to another php page carrying with me the server_id. so this is somewhat similar to submitting a form but instead of clicking a submit button I click the server_id (id). do I have to use onClick?? Link to comment https://forums.phpfreaks.com/topic/53799-solved-javascritp-and-php-submit-form/#findComment-266283 Share on other sites More sharing options...
nogray Posted June 1, 2007 Share Posted June 1, 2007 You can have this echo " <td><a href='modify.php?id1=$id1'> {$row['server_id']} [/url]</td>"; Instead of your whole form. If you modify.php you can access the id1 in the super global _GET or _REQUEST variable $_GET['id1'] $_REQUEST['id1'] Link to comment https://forums.phpfreaks.com/topic/53799-solved-javascritp-and-php-submit-form/#findComment-266385 Share on other sites More sharing options...
jr8rdt Posted June 1, 2007 Author Share Posted June 1, 2007 it works!! Thanks Link to comment https://forums.phpfreaks.com/topic/53799-solved-javascritp-and-php-submit-form/#findComment-266540 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.