didgydont Posted December 17, 2007 Share Posted December 17, 2007 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 https://forums.phpfreaks.com/topic/82095-make-a-result-a-link/ Share on other sites More sharing options...
lemmin Posted December 17, 2007 Share Posted December 17, 2007 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 https://forums.phpfreaks.com/topic/82095-make-a-result-a-link/#findComment-417168 Share on other sites More sharing options...
revraz Posted December 17, 2007 Share Posted December 17, 2007 Would be much easier if you used a link like newpage.php?user=1 And then used $_GET on the newpage.php Link to comment https://forums.phpfreaks.com/topic/82095-make-a-result-a-link/#findComment-417170 Share on other sites More sharing options...
didgydont Posted December 17, 2007 Author Share Posted December 17, 2007 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 https://forums.phpfreaks.com/topic/82095-make-a-result-a-link/#findComment-417214 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.