Hi,
I have a form with various elements such as ids, location. I need to pass these values to a php file through a javascript function. Right now I am able to pass only ids.
The Form
<form action="display.php">
<label>Your ID</label>
<input type="text" id="ids" name="ids" value="">
<label>Location</label>
<select name="location" id="location">
<option>City 1</option>
<option>City 2</option>
<option>City 3</option>
<option>City 4</option>
<label>Interest</label>
<input type="checkbox" name="interest[]" value="Friends" />
<input type="checkbox" name="interest[]" value="Books" />
<input type="checkbox" name="interest[]" value="Music" />
<input type="checkbox" name="interest[]" value="Debates" />
</form>
I am passing the values to the php files through javascript
function passvalues(url, boxid){
var A = document.getElementById('ids').value;
url = url + "?ids=" + A;
.......
........}
PHP File
$ids=$_GET['ids'];
echo $ids;
echo "<br>";
How should I pass 'location' and 'Interest' values also to the php file?
I tried this :-
var B = document.getElementById('location').value;
url = url + "?ids=" + A;
url = url + "?location=" + B;
if 12345 is the id this returns
12345?location=City1