i have a form with some hidden fields.....
index.php page....
<form id="addReplyForm" method="post" action="">
<input type="text" id="target" name="commentreply" />
<input type="hidden" id="session_id" name="session_id" value="" />
<input type="hidden" id="page_id" name="page_id" value="" />
<input type="hidden" id="firstName" name="firstName" value="" />
<input type="hidden" id="lastName" name="lastName" value="" />
<input type="submit" id="submitReply" value="Reply" />
</form>
when u user clicks on the text field to enter text i would like all the other values to be automatically filled in, with there session_id, the page_id, there name.
so that when it uploads to the database i get the persons relavent information.
these are my varibles to be put in values,
myVaribles.php page....
// some thing like this.....
$sessionid = $_SESSION['profile_id'];
$page_id = $_GET['id'];
q = "SELECT firstName, lastName FROM users WHERE id = '$sessionid'";
$result = $mysqli->query($q) or die('error');
if($result) {
while($row = $result->fetch_object()) {
$firstname = $row->firstname;
$lastname = $row->lastname;
}
}
so as u can see i have 4 varibles on myVaribals.php page that i want to grab and put into my form in index.php page when the user clicks on the text field.
my jQuery so far.....
$(document).ready(function(){
$('#target').click(function() {
$('#session_id').val('');
$('#page_id').val('');
$('#firstName').val('');
$('#lastName').val('');
// dont know how to get the values in :(
}
please help me :)