Aaron Aaron - 7 months ago 49
PHP Question

How to get a text box value using HREF without POST


<a href="http://localhost/check.php?date=textbox1&time=textbox2" onclick="window.open('http://localhost/check.php?date=textbox1&time=textbox2', 'newwindow', 'width=600, height=600'); return false;"> <i class="glyphicon glyphicon-plus"></i></a>

This is my current code, I would like to transfer textbox 1 and textbox 2 value on a GET method. I tried
.value but no luck.

Thank you.


I'm not sure what you are trying to do here. From what I understand, you have this...:

<input type="text" id="date"/>
<input type="text" id="time"/>

...and you want to use these textbox values for request parameters. Try this:

function submitDateAndTime() {
  var url = 'http://localhost/check.php?date=';
  url += document.getElementById('date').value;
  url +='&time=';
  url += document.getElementById('time').value;
  // Do whatever you want with the URL here
  // For example, window.open to load in a new window:
  // Or use _self if you want to load in the current window
  window.open('url', '_self');
  // Or ajax, etc.

and for HTML:

<a href="javascript:void submitDateAndTime();">Submit</a>