Reputation: 67
Here is my problem, I want my script to do this: -before the user reject entry(server side), system must prompt text box asking the reason why they want to reject it. and then save the reason they input to MySQL server.
Javascript Function:
function MyReason(){
var reason = prompt("Reason");
}
PHP Snippet:
echo "<td> <a href=changeStatReject.php?id=" . $row['id'] . ">" . "<img src='media/reject.png'>" . "</a></td>";
From Here, I want to get the value of prompt box and pass it to
changeStatReject.php
and save it in DB.
Thanks Mates.
Upvotes: 1
Views: 9453
Reputation: 450
You can send value to hidden input in the form and submit it.
function MyReason(){
var reason = prompt("Reason");
document.getElementById("reason").value = reason;
document.getElementById("form").submit();
}
<form id="form">
<input type="hidden" id="reason" />
</form>
Upvotes: 3
Reputation: 1167
try this code:
function MyReason(){
var reason = prompt("Reason");
document.getElementById('hiddenNameField').value = reason;
document.forms(0).submit();
}
Upvotes: 0