Anyone out there who can help with linking JavaScript and PHP?
I have acquired some script that processes data collected from a <form> and then attaches the data to the URL of the page that will receive it. This works fine, except that I do not get an âactionâ that I can process using a $_REQUEST statement on the receiving page.
The details are:
The html form collects data and then the JavaScript is activated by calling the submitForm() JavaScript function using onClick.
The key parts of the Form html are:
<form method="get" action="sorter_test1.php" name="form">
.
.
.
<input type="button" value="Set Headline Order" onClick="submitForm()">
The submitForm JavaScript function then processes and creates two strings. document.form.action takes the URL from the âactionâ attribute in the <form> tag and theList is a data string â?fred=12345â .
The following statement transfers control to the next page with a URL
http://sorter_test1,php?fred=1234
location.href = document.form.action + theList;
My problem is that I would also like to pass the âSet Headline Orderâ value in the <input> tag so that I see it using a $_REQUEST in the receiving page (sorter_test1.php). Can anyone suggest how I can fix this? I suspect there is a statement that I can add to the JavaScript, but as I know precious little about JavaScript I cannot work out what it should be.