I have created a form which onsubmit runs a function in another file (results.php
)(files have been loaded using jQuery). However, I am uable to access the form inputs on the other file (results.php
).
I created a test to see whether the array was even set, and it wasnt. Is there any way i can set the array on the form? If not, how do I access the inputs of the form in another php file?
Please beware that I cannot use action="example.php"
as this loads a new page and I am trying to avoid this (using AJAX and jQuery).
Here is the form:
<form onsubmit="loadCatering();return false;">
<table>
<tr>
<td><label for="venueName">Venue Name:</label></td>
<td>
<select id="venueName" name="venueName"required>
<option value = "1">Central Plaza</option>
<option value = "2">Pacific Towers</option>
</select>
</td>
</tr>
<tr>
<td><label for="submit">Check Catering Grades:</label></td>
<td><input type="submit" /></td>
</tr>
</table>
</form>
</html>
This is the script in results.php
which attempts to access the data within the form:
<?php
if(isset($_GET['venueName'])){
echo "yes";
}
else{
echo "not set";
}
?>
Note - not set gets echoed when running this.
Also note, the function loadCatering()
simply loads results.php
using jQuery.If you would lke to see the contents of this function please let me know