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">
<td><b>Your score is: </b> <br /><input type="text" disabled="disabled" name="score" value="$total"></td>
<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>

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. :)

7 Years
Discussion Span
Last Post by sudeepjd

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.