Jump to content

Button


{A_K_A}

Recommended Posts

Hi,I have a button that I want it to display results from a SQL DB when clicked. So when the button is clicked i want it to give my other code a value that it will use to get the appropriate data back.My problem is that I have no idea how to get the button to pass this var to my other code when and only when clicked. Thanks in advance for your help I have spent a long time thinking about this and the only sensible way seems to be to use onClick but no matter whatI try it give me an error :) Thanks

Link to comment
Share on other sites

The words "other code" aren't very helpful. What is the "other code"? Where is the "other code"? Where is the data you've pulled from SQL?In other words, do you want the button to launch activity in a javascript in your document, or do you want it to launch activity in some script (PHP, maybe) on your server?

Link to comment
Share on other sites

Hi,sorry I was a bit vague. while ($row = mysql_fetch_array ($result)) { $quesR1 = $row ['title']; $quesID = $row ['id']; print "<form action = 'Wines.php' method ='get' href= Region.php?id= '$quesID['id']'>"; // Print out buttons with the names provided me the sql db print '<input type="submit" class="groovybutton" onMouseOver="goLite(this.form.name,this.name)" onMouseOut="goDim(this.form.name,this.name)" value ='. "$quesR1" .'>' .'<br>'; print "</from>" }this is what I have so far. I want to send $quesID to another page region where i can use it to compare it with another ID. I do not want to use JavaScript I want to use action but i am unable to get it to work.any help to get this working, I will appreciate it a lot :)

Link to comment
Share on other sites

Hi, i would put name to the form, something like: name="myform'.$quesID['id'].'", so every form you have is unique.also put a hidden input to hold the id, this way you can catch it on wines.php.try to 'split' the html from the php, like:<?php...//code//code...?><input type .... /><?php ...?>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...