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.
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>
try this code:
function MyReason(){
var reason = prompt("Reason");
document.getElementById('hiddenNameField').value = reason;
document.forms(0).submit();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.