Jump to content

[SOLVED] javascritp and PHP: submit form


jr8rdt

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.