Hi I have a php script that refers to another html file inside of its one of the button handlers. It passes an argument called serial_no_html, and inside the other html (change.html) I parse the url (window.location.href), and use it.
Code in PHP:
<form action="change.html" method="get"> <input type="submit"
name="serial_no_html" id="serial_no_html" value="'.$serial_no.'"/></form>```
Code in change.html:
var element = document.getElementById("serialNumber");
var sn = getParameterByName('serial_no_html');
window.location.search;
element.innerHTML = sn;
This all works, how ever I need to send multiple parameters now. How exactly can that be done? With added & ? For example :
<form action="change.html" method="get"> <input type="submit" name="serial_no_html"
id="serial_no_html" value="'.$serial_no.' & name="second_parameter"
id="second_parameter_html" value="'.$second_parameter.'"/></form>
Did I get the syntax right?
Thanks Ratin
CodePudding user response:
You can't put multiple names and values in the same <input>
, you need to use multiple input fields. This is what type="hidden"
inputs are for.
<form action="change.html" method="get">
<input type="hidden" name="second_parameter" value="'.$second_parameter.'">
<input type="submit" name="serial_no_html" id="serial_no_html" value="'.$serial_no.'"/>
</form>