Jump to content

make a result a link


didgydont

Recommended Posts

hi all

i am a noob to php but have managed to make a result a link as a form button but it creates pretty big gapps between the buttons i would prefer if i could make just a text style link if i can does anyone know how ? this is the code i have

echo "<h2>Client Names</h2>";
while($row = mysql_fetch_array($result))
  {
  $uid = $row['Uid'];
  $name = $row['FirstName'] ." ". $row['LastName'];
  echo "<form action=\"idsearch.php\" method=\"post\">";
  echo "<input type=\"hidden\" name=\"Uid\" value=\"$uid\">";
  echo "<input type=\"submit\" VALUE=\"$name\">" ;
  echo "</form>";
  }
mysql_close($con);

Link to comment
Share on other sites

Do you mean that you want a text link to submit a form to another php file? You can do that with javascript:

<form id="tForm" method=POST>
<input type=HIDDEN>
<a href=# onClick="tForm.submit()>Visible Link</a>
</form>

 

But, I'm not sure that is what you are trying to do.

 

Also, your code will make a brand new form for every result in the query. You should probably put the form tag outside of the loop.

Link to comment
Share on other sites

Do you mean that you want a text link to submit a form to another php file? You can do that with javascript:

<form id="tForm" method=POST>
<input type=HIDDEN>
<a href=# onClick="tForm.submit()>Visible Link</a>
</form>

 

But, I'm not sure that is what you are trying to do.

 

Also, your code will make a brand new form for every result in the query. You should probably put the form tag outside of the loop.

 

 

i think i want a new form each time because every button takes you to different results

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.