I have a form with seven categories, each has a title and a answer, but one has three answers and another two... I have the data stored in a table, each entry is identified by a entry_no.
I want to get each category and display them in the form here's the code I'm using at present;
$entry_uid = 12340001
$msql = " SELECT category,entry_title,entry_file_1,entry_file_2,entry_file_3,entry_uid FROM entry_categories WHERE entry_uid = '$id' ";
$qry = mysql_query($msql);
while ($cat = mysql_fetch_assoc($qry)) {
if ($cat['category'] == '1') {
echo '<label class="field-entry">
1. Exclusive News/Sports Story of the Year (title)<input type="text" name="" value="'. $cat['entry_title'] .'" disabled /></label>
<label class="field-upload1">Select story file (any .doc, .docx, .txt, .rtf format)<input type="text" name="" value="'. $cat['entry_file_1'] .'" disabled="disabled" /></label>';
} else {
echo '<label class="field-entry"><input type="hidden" name="Cat_1" value="1" />
1. Exclusive News/Sports Story of the Year (title) <input type="text" name="Title_1" value="" /></label>
<label class="field-upload1">Select story file (any .doc, .docx, .txt, .rtf format) <input type="file" name="File_1_1" value="" /></label>';
}
if ($cat['category'] == '2') {
echo '<label class="field-entry">
2. Spec News/Sport Story of the Year (title) <input type="text" name="" value="'. $cat['entry_title'] .'" disabled /></label>
<label class="field-upload1">Select story file (any .doc, .docx, .txt, .rtf format)<input type="text" name="" value="'. $cat['entry_file_1'] .'" disabled="disabled" /></label>';
} else {
echo '<label class="field-entry"><input type="hidden" name="Cat_1" value="1" />
2. Spec News/Sport Story of the Year (title) <input type="text" name="Title_2" value="" /></label>
<label class="field-upload1">Select story file (any .doc, .docx, .txt, .rtf format) <input type="file" name="File_2_1" value="" /></label>';
}
I want to get each category and display them in the form here's the code I'm using at present;
$entry_uid = 12340001
$msql = " SELECT category,entry_title,entry_file_1,entry_file_2,entry_file_3,entry_uid FROM entry_categories WHERE entry_uid = '$id' ";
$qry = mysql_query($msql);
while ($cat = mysql_fetch_assoc($qry)) {
if ($cat['category'] == '1') {
echo '<label class="field-entry">
1. Exclusive News/Sports Story of the Year (title)<input type="text" name="" value="'. $cat['entry_title'] .'" disabled /></label>
<label class="field-upload1">Select story file (any .doc, .docx, .txt, .rtf format)<input type="text" name="" value="'. $cat['entry_file_1'] .'" disabled="disabled" /></label>';
} else {
echo '<label class="field-entry"><input type="hidden" name="Cat_1" value="1" />
1. Exclusive News/Sports Story of the Year (title) <input type="text" name="Title_1" value="" /></label>
<label class="field-upload1">Select story file (any .doc, .docx, .txt, .rtf format) <input type="file" name="File_1_1" value="" /></label>';
}
if ($cat['category'] == '2') {
echo '<label class="field-entry">
2. Spec News/Sport Story of the Year (title) <input type="text" name="" value="'. $cat['entry_title'] .'" disabled /></label>
<label class="field-upload1">Select story file (any .doc, .docx, .txt, .rtf format)<input type="text" name="" value="'. $cat['entry_file_1'] .'" disabled="disabled" /></label>';
} else {
echo '<label class="field-entry"><input type="hidden" name="Cat_1" value="1" />
2. Spec News/Sport Story of the Year (title) <input type="text" name="Title_2" value="" /></label>
<label class="field-upload1">Select story file (any .doc, .docx, .txt, .rtf format) <input type="file" name="File_2_1" value="" /></label>';
}