Reputation: 301
I have a very long program, and I have this problem. I have the following code:
<li>
<label for="edit_cp">CP:</label>
<input id="edit_cp" type="text" name="edit_cp" placeholder="Postal Code" required />
</li>
And In PHP:
$query = "SELECT * FROM shops";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "<p style='font-size:12px'> <input type='radio' name='tienda' value='$row[ID]' required> $row[Nombre] ($row[Direccion])";
}
mysql_close($link);
This is only a two parts of my program, so I can't use a form and get the $_POST or similar. I have to use the result of the edit_cp variable and use it into the php. I want it to calculate a nuber. For example if the entered number is for example 2 and in the while the number is 2, it will be selected.
Upvotes: 1
Views: 76
Reputation: 91
Try
$.post( "path/to/handler", { edit_cp : $('#edit_cp').val()}).done(function( data ) {
alert( "Data Loaded: " + data );
});
Don't forget to bind this script to some action, ex.:
$('#post').once('click',function(){
$.post( "path/to/handler", { edit_cp : $('#edit_cp').val()}).done(
function( data ) {alert( "Data Loaded: " + data );
});
});
Upvotes: 1