Page 1 of 1

a newbie in need --pre-filled form values for an edit form

Posted: Sun Nov 17, 2002 5:25 pm
by ike_obi
I currently working on the edit page that enables users to change their cv details. Like personal, education, employment, skills and reference details.

This is a bit of form code from the edit page (the education section)

<tr>
<td class=tstyle>Institute Name</td>
<td class=tstyle align="center">Qualifications</td>
<td class=tstyle>Primary subject<br>
<font size=-2>(example: Accounting)</td>
<td class=tstyle align="center">Year<br><font size=-2>
(example: 1992)
</td>
</tr>


for ($x=0; $x<5; $x++)
{
<tr>
<td>
<input type="text" name="institute[]" size="20" maxlength="255"></td>
<td align="center"><select name="qual[]">

Code: Select all

&lt;?php
while (list($id, $qual) = mysql_fetch_row($qual_result))
    {
    echo "&lt;option value=$id";
        if($id == $qual)
        {
         echo"selected";
        }
    echo"&gt;$qual&lt;/option&gt;";
      
    }
// same data, no need to query again
mysql_data_seek($qual_result, 0);
?&gt;
?&gt;
</select>
</td>
<td><select name="subject[]">

Code: Select all

&lt;?php
while (list($id, $subject) = mysql_fetch_row($subject_result))
    {
    echo "&lt;option value=$id";
        if($id == $subject)
        {
          echo"selected";
        }
    echo"&gt;$subject&lt;/option&gt;";    
    }
// same data, no need to query again
mysql_data_seek($subject_result, 0);
?&gt;
</select></td>
<td align="center"><input type="text" name="qual_year[]"
"size="4" maxlength="4"></td>
</tr>

Code: Select all

&lt;?php
mysql_free_result($qual_result);
mysql_free_result($subject_result);
?&gt;

I am having problems trying to do an edit form with the pre-filled values.
Please help me anyone?? :( I'm really stuck here.

I've pulled out the data from the education table like below:


And i'm going about updating like

I need help

I thought i'd include this for clarity purposes:

TABLE education feilds below.

[quote]
cvid
institute
fk_qual
fk_subject
year year
KEY fk_qual (fk_qual),
KEY fk_subject (fk_subject),
KEY cvid (cvid)
) TYPE=MyISAM;

Not sure

Posted: Thu Nov 21, 2002 11:45 am
by Rincewind
..what you mean, but if your problem is that you want the old values to be
pre-filled when you open a form to edit it you only need to include the
"value" option in your code like this:

<input type='text' name='address' value='$address'>

Where $address is the address stored previously

Not sure if this was your problem, but anyway...

Rincewind