I have a hidden field in form. On form submit I call a database function to add the inputs to database and return result of query. I wish to set the value returned to hidden field. But when I am not able to assign a value to it
<form name="frmAddBook" id="frmAddBook" method="post">
<input type="hidden" name="actionResult" id="actionResult">
echo '
<script type="text/javascript">
alert("hello");
document.getElementById("actionResult").value=1;
alert("2222222");
alert(document.frmAddBook.getElementById("actionResult").value);
</script>';
you need to specify the value of that hidden input field, so if you wanted to do this in PHP it'd look like this:
<input type="hidden" name="actionResult" id="actionResult" value="<?php echo $result; ?>"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With