Is there a more efficient way to code this? I'm still learning.
PHP Code:
if ($_POST['do'] == 'edit')
{
$vbulletin->input->clean_array_gpc('p', array(
'image_1' => TYPE_NOHTML,
'url_1' => TYPE_NOHTML,
'subtitle_1' => TYPE_NOHTML,
'title_1' => TYPE_NOHTML,
'id_1' => TYPE_INT,
'image_2' => TYPE_NOHTML,
'url_2' => TYPE_NOHTML,
'subtitle_2' => TYPE_NOHTML,
'title_2' => TYPE_NOHTML,
'id_2' => TYPE_INT,
'image_3' => TYPE_NOHTML,
'url_4' => TYPE_NOHTML,
'subtitle_3' => TYPE_NOHTML,
'title_3' => TYPE_NOHTML,
'id_3' => TYPE_INT,
'image_4' => TYPE_NOHTML,
'url_4' => TYPE_NOHTML,
'subtitle_4' => TYPE_NOHTML,
'title_4' => TYPE_NOHTML,
'id_4' => TYPE_INT,
'image_5' => TYPE_NOHTML,
'url_5' => TYPE_NOHTML,
'subtitle_5' => TYPE_NOHTML,
'title_5' => TYPE_NOHTML,
'id_5' => TYPE_INT
));
$db->query_write("UPDATE featured_band SET title = '".$vbulletin->GPC['title_1']."', subtitle = '".$vbulletin->GPC['subtitle_1']."', url = '".$vbulletin->GPC['url_1']."', image = '".$vbulletin->GPC['image_1']."' WHERE id =".$vbulletin->GPC['id_1']."");
$db->query_write("UPDATE featured_band SET title = '".$vbulletin->GPC['title_2']."', subtitle = '".$vbulletin->GPC['subtitle_2']."', url = '".$vbulletin->GPC['url_2']."', image = '".$vbulletin->GPC['image_2']."' WHERE id =".$vbulletin->GPC['id_2']."");
$db->query_write("UPDATE featured_band SET title = '".$vbulletin->GPC['title_3']."', subtitle = '".$vbulletin->GPC['subtitle_3']."', url = '".$vbulletin->GPC['url_3']."', image = '".$vbulletin->GPC['image_3']."' WHERE id =".$vbulletin->GPC['id_3']."");
$db->query_write("UPDATE featured_band SET title = '".$vbulletin->GPC['title_4']."', subtitle = '".$vbulletin->GPC['subtitle_4']."', url = '".$vbulletin->GPC['url_4']."', image = '".$vbulletin->GPC['image_4']."' WHERE id =".$vbulletin->GPC['id_4']."");
$db->query_write("UPDATE featured_band SET title = '".$vbulletin->GPC['title_5']."', subtitle = '".$vbulletin->GPC['subtitle_5']."', url = '".$vbulletin->GPC['url_5']."', image = '".$vbulletin->GPC['image_5']."' WHERE id =".$vbulletin->GPC['id_5']."");
$vbulletin->url = "/index.php?" . $vbulletin->session->vars['sessionurl'];
eval(print_standard_redirect('usercss_saved'));
exit;
}
PHP Code:
echo '<form action="fb.php" method="post"><input type="hidden" name="do" value="edit" /><div style="height:350px; overflow:auto; padding:0 8px 0px 0px;"><div class="round alt1 twelve" style="padding:8px;margin-top:4px;border:1px solid #dcdcdc">';
$editfeature = $vbulletin->db->query_read("SELECT * FROM featured_band ORDER BY id LIMIT 5");
while ($entry = $vbulletin->db->fetch_array($editfeature))
{
echo '<div class="boxhead">Spot '.$entry['id'].'</div>
<div class="menu_nl"><div style="float:left;">Title:</div><div align="right"><input name="title_'.$entry['id'].'" type="text" class="bginput" size="40" value="'.$entry['title'].'"></div></div>
<div class="menu_nl"><div style="float:left;">Sub-Title:</div><div align="right"><input name="subtitle_'.$entry['id'].'" type="text" class="bginput" size="40" value="'.$entry['subtitle'].'"></div></div>
<div class="menu_nl"><div style="float:left;">Link:</div><div align="right"><input name="url_'.$entry['id'].'" type="text" class="bginput" size="40" value="'.$entry['url'].'"></div></div>
<div class="menu_nl"><div style="float:left;">URL to Image:</div><div align="right"><input name="image_'.$entry['id'].'" type="text" class="bginput" size="40" value="'.$entry['image'].'"></div><br />Note: Must be 414 pixels wide by 173 pixels high.</div><input type="hidden" name="id_'.$entry['id'].'" value="'.$entry['id'].'" />';
}
echo '</div></div>';
echo '<div align="center" style="padding-top:8px;"><input name="" class="btnb" type="submit" value="Save Changes"></div></form>';