snyx
Fri 20th Sep '02, 5:51pm
hey all, im trying to customize this links script to fit my website, and what I wanna do is have the language field have a language selected when you load the page (ie. english) and not have it as "--select a language--" the category field below it auto selects the first category added.. so basically the bottom ones does what I want the top one to do. I played with this since 9am this morning, and not being a coder or any sort (I know html, lol) any help would be appreciated!!
thanks guys!
<tr>
<td><?=ADD_HP_LANG?></td>
<td align='center'>
<? //get languages from db
$res = MYSQL_QUERY("SELECT * FROM $table_languages order by lang"); // get lang. from db
echo "<select name='lang' onmouseover='this.focus()'>\n";
echo "<option value=''>".ADD_HP_CAT_SELECT."\n";
while ($row = MYSQL_FETCH_ARRAY($res)) // render lang-selection
{
if($lang == $row[lang]) { //render <select> for lang and select a lang, if set
echo "<option value='$row[lang]' selected>$row[lang]\n";
} else {
echo "<option value='$row[lang]'>$row[lang]\n"; }
}
MYSQL_FREE_RESULT($res); // give memory free
echo "</select>\n"; ?>
</td>
</tr>
<tr>
<td><?=ADD_HP_CAT?></td>
<td align='center'>
<? //generate select-field with cat's
$result = MYSQL_QUERY("SELECT * FROM $table_cat order by $catorder"); // get cats from db
// generate cat-selection <select>
echo "<select name='add_cat' onmouseover='this.focus()'>\n";
echo "<option value=''>".ADD_HP_CAT_SELECT."\n";
while ($row = MYSQL_FETCH_ARRAY($result))
{
if($row[id] == $from) { // render <select> for cats and select a cat, if redirected from there
echo "<option value='$row[id]' selected>$row[name]\n";
} elseif($add_cat == $row[id]) { echo "<option value='$row[id]' selected>$row[name]\n";
} else { echo "<option value='$row[id]'>$row[name]\n"; }
}
MYSQL_FREE_RESULT($result); // give memory free
echo "</select>\n"; ?>
</td>
</tr>-Myles
(sorry dbl posted @ vb.org cuz im itchin for help)
thanks guys!
<tr>
<td><?=ADD_HP_LANG?></td>
<td align='center'>
<? //get languages from db
$res = MYSQL_QUERY("SELECT * FROM $table_languages order by lang"); // get lang. from db
echo "<select name='lang' onmouseover='this.focus()'>\n";
echo "<option value=''>".ADD_HP_CAT_SELECT."\n";
while ($row = MYSQL_FETCH_ARRAY($res)) // render lang-selection
{
if($lang == $row[lang]) { //render <select> for lang and select a lang, if set
echo "<option value='$row[lang]' selected>$row[lang]\n";
} else {
echo "<option value='$row[lang]'>$row[lang]\n"; }
}
MYSQL_FREE_RESULT($res); // give memory free
echo "</select>\n"; ?>
</td>
</tr>
<tr>
<td><?=ADD_HP_CAT?></td>
<td align='center'>
<? //generate select-field with cat's
$result = MYSQL_QUERY("SELECT * FROM $table_cat order by $catorder"); // get cats from db
// generate cat-selection <select>
echo "<select name='add_cat' onmouseover='this.focus()'>\n";
echo "<option value=''>".ADD_HP_CAT_SELECT."\n";
while ($row = MYSQL_FETCH_ARRAY($result))
{
if($row[id] == $from) { // render <select> for cats and select a cat, if redirected from there
echo "<option value='$row[id]' selected>$row[name]\n";
} elseif($add_cat == $row[id]) { echo "<option value='$row[id]' selected>$row[name]\n";
} else { echo "<option value='$row[id]'>$row[name]\n"; }
}
MYSQL_FREE_RESULT($result); // give memory free
echo "</select>\n"; ?>
</td>
</tr>-Myles
(sorry dbl posted @ vb.org cuz im itchin for help)