Jump to content

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

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...