Reputation: 45
I have a dialog box from an ajax file where there is a dropdown menu (1-5) and a submit button. Once the user clicks the submit button and chooses a value, I want ajax to call update_ajax.php and run a mysql update to update the level to what ever the user selected. This is my mangled ajax.
$(".changelevel").click( function() {
// Enables the dialog window and shows the form
$( "#clevel" ).dialog();
$("form").show();
$("#clevel").submit( function() {
$.post("update_ajax.php", $("#changefl").serialize());
} );
} );
This is my also mangled php sql query:
<?
require_once( ".htpasswd" );
$value=$_POST['id'];
$primarykey=$_POST['pk'];
$query = "UPDATE friendlevel = ".$value." FROM address WHERE id = ".$primarykey."";
$result = mysql_query($query);
?>
So when the ajax runs it should find out what the persons primarykey(idnum) is and the new level they want to set and pass them to the query where it is updated.
Upvotes: 1
Views: 681
Reputation: 968
require_once( ".htpasswd" );
It's impossbile, you can read it $htpasswd = file_get_contents('.htpasswd')
;
Upvotes: 2