0

Hi..
im PHP user..
i want to get a text box value to the Php variable by clicking hyperlink and i want to send that value to database using mysql query. i want to know that is how can i get text box value to the PHP variable clicking by hyperlink. not by clicking submit button..
thank you..

5
Contributors
9
Replies
36
Views
7 Years
Discussion Span
Last Post by Kadafiz
0

hmm... if I understand you, you have a text box that a user will enter data into and when they click a link (<a href='blah.php'>) you want the contents of that text field passed as a parameter to the file on the link (blah.php). Is that right?

I think you would do this with javascript on the page with the text box using an onclick="do this stuff here" function to get the contents of the text box and modifying the href.

I'm just guessing here but thats where I'd start...

0

try to use
<a href='blah.php?textboxname='+formname.textboxname.value>
something like that.

0

yeah ppetree u got my prob.. i can get that value using java script . bt thing is i dont knw hw to get value from java script variable to php variable. coz i need that value pass to php variable. can u plz tell me..

0

<a href='blah.php?textboxname='+formname.textboxname.value>

just read using $_GET

alternatively, use an ordinary FORM, and submit it using javascript.

onclick = "document.forms[0].submit()"

0
<input type="text" name="url_param" id="url_param" /> 
<input type="button" onclick="prepare_link();" value="Do it!" /> 
 
<a href="http://whatever.com" id="target_link" onclick="append_link()">Click Your New Link!</a>
<script type="text/javascript"> 
function append_link() { 
  var url_param = document.getElementById('url_param'); 
  var target_link = document.getElementById('target_link'); 
 
  if ( ! url_param.value ) { 
      return false;   
  } 
 
  target_link.href = target_link.href + '/=url_param?' + escape(url_param.value); 
} 
</script>
1
<script type="text/javascript">
function ftest(){
window.location="totherecievingpagedatabasesave.php?test="+document.getElementById('test').value;
}
</script>

<input type="text" name="test" id="test" />
<a href="javascript:void(0);" onclick="ftest()">click me</a>

then get the text box variable on the receiving end via $_GET;

Votes + Comments
thank you
0

I think I like Vault's better! LOL

Obviously, there is more than one way to do this!

Edited by ppetree: n/a

0

Thank you for all to answering me.. i did it.. and thanx vaultdweller123.. :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.