Hi,
When creating a table for a form that contains readonly fields, the readonly fields do NOT show up as database fields. I tried adding them manually, naming the fields in the database the same as they are on the form, but the values are NOT being saved. How can I save readonly fields to the database?
Thanks.
When creating a table for a form that contains readonly fields, the readonly fields do NOT show up as database fields. I tried adding them manually, naming the fields in the database the same as they are on the form, but the values are NOT being saved. How can I save readonly fields to the database?
Thanks.
Hi Kmonsefi,
Basically you can't - readonly field values aren't included in the $_POST arry that is sent back to the server.
You can use disabled fields, or you can put the values of the readonly fields into hidden fields with the same name - those will be saved.
Bob
Basically you can't - readonly field values aren't included in the $_POST arry that is sent back to the server.
You can use disabled fields, or you can put the values of the readonly fields into hidden fields with the same name - those will be saved.
Bob
Disabled fields don't seem to work either. How would you suggest using hidden fields to accomplish this?
Hi Kmonsefi,
Oops yes, I was wrong. Disabled fields are worse than readonly.
If you put the value in a hidden field that it will be returned and saved, not sure what else there is to say about that.
What are you trying to do with the readonly fields here?
Bob
Oops yes, I was wrong. Disabled fields are worse than readonly.
If you put the value in a hidden field that it will be returned and saved, not sure what else there is to say about that.
What are you trying to do with the readonly fields here?
Bob
If users are logged in, I'm prepopulating the name and email fields for my forms. Since these fields should not be changeable when logged in, I'm making them readonly.
Regarding using hidden fields, would my code look like this?
<input id="Name" maxlength="50" size="30" name="Name" value="Logged In Name" readonly />
<input id="Name" maxlength="50" size="30" name="Name" value="Logged In Name" type="hidden" />
Regarding using hidden fields, would my code look like this?
<input id="Name" maxlength="50" size="30" name="Name" value="Logged In Name" readonly />
<input id="Name" maxlength="50" size="30" name="Name" value="Logged In Name" type="hidden" />
This topic is locked and no more replies can be posted.