Here's my situation, I have 2 pages, one for selecting a value and one for editing database related things which are associated to that value.
Right now, I have no knowledge ( and have researched a fair bit ) on how to save the value selected from the drop down list into a variable from PHP.
Any ideas?
Its two step:
First html:
<form action='databasethings.php' method=post>
<select name="myvalue">
<option value="value1">Value 1</option>
<option value="value2">Value 2</option>
<option value="value3">Value 3</option>
</select>
<input type=submit>
</form>
Its for sending the value to databasethings.php script.(
Then in databasethings.php:
$myvalue=$_POST['myvalue'];
//do something with myvalue
This will catch value1, 2 or 3 from html into $myvalue in php
HTML:
<form action="page.php" method="get">
<select id="drop" name="drop">
<option value="Volvo">Volvo</option>
<option value="Saab">Saab</option>
<option value="Mercedes">Mercedes</option>
<option value="Audi">Audi</option>
</select>
<input type="submit" value="Submit!">
</form>
page.php:
<?php
echo $_GET['drop'];
?>
I presume you are submitting a form to the page for editing database related things. On that page use $_REQUEST['the_name_of_the_select_box']
<select name="the_name_of_the_select_box">
the select value will be in
$_REQUEST['the_name_of_the_select_box'] or $_POST['the_name_of_the_select_box']
might like this
$('element').change(function(){
$.ajax({
url:"savepage",
type:"POST",
data:({}),
dataType:"html", // json // xml
async:false,
success: function(msg){
alert(msg); // get result
}
});
});