a newbie in need --pre-filled form values for an edit form
Posted: Sun Nov 17, 2002 5:25 pm
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[]">
</select>
</td>
<td><select name="subject[]">
</select></td>
<td align="center"><input type="text" name="qual_year[]"
"size="4" maxlength="4"></td>
</tr>
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;
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
<?php
while (list($id, $qual) = mysql_fetch_row($qual_result))
{
echo "<option value=$id";
if($id == $qual)
{
echo"selected";
}
echo">$qual</option>";
}
// same data, no need to query again
mysql_data_seek($qual_result, 0);
?>
?></td>
<td><select name="subject[]">
Code: Select all
<?php
while (list($id, $subject) = mysql_fetch_row($subject_result))
{
echo "<option value=$id";
if($id == $subject)
{
echo"selected";
}
echo">$subject</option>";
}
// same data, no need to query again
mysql_data_seek($subject_result, 0);
?><td align="center"><input type="text" name="qual_year[]"
"size="4" maxlength="4"></td>
</tr>
Code: Select all
<?php
mysql_free_result($qual_result);
mysql_free_result($subject_result);
?>I am having problems trying to do an edit form with the pre-filled values.
Please help me anyone??
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;