0

Gudeve. sorry for posting again. i was making a simple quiz machine with PHP and a bit of database,

i made this code.

<form action="record.php" method="POST">
<tr>
<td><b>Your score is: </b> <br /><input type="text" disabled="disabled" name="score" value="$total"></td>
</tr>
<tr>
<td><b>Date: </b> <br /><input type="text" name="date"></td>
<td><b>Student Id: </b> <br /><input type="text" name="stud"></td>
<td><b>First Name: </b><br /><input type="text" name="fname"> <br /></td>
<td>  <b>Last Name:</b><br /><input type="text" name="lname"></td></tr>
<td><input type="submit" value="Submit Details"></td>
</form>

so basically. the score textbox is disabled so that the user cannot change the score. xD
if works fine recording it in my database but the disabled text didn't appear on the database. instead of, for example 6. there's nothing, the row is empty.

is there any way to make that score record on my database using the disabled textbox?. thankyou very much. :)

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by sudeepjd
0

If you post values from a disabled textbox it will not get transfered over. In order to make the transfer there are 2 ways.

1. Enable the text box using javascript or

2. The easier method is to create a hidden text field and put the score in both places. This cannot be edited by the user. <input type="hidden" value="<?php echo $total; ?>" name="score_p" /> Let me know if you need any help.

Edited by sudeepjd: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.