|
-
Nov 26th, 2006, 08:41 PM
#7
Re: 2 Very quick questions
javascript can't do what you want to do.
I would say the best possibility is what I posted just above your post (not sure if you've seen it or not). For <select> and checkbox form fields, it will all depend on how you're building your form. Basically, for your <select>, you will do this:
PHP Code:
Category: <select name="category">
<?php
$i=0;
while($i < $num){
$catid=mysql_result($result,$i,"Catid");
$catname=mysql_result($result, $i, "Catname");
echo '<option value="$catid"';
if(isset($_POST['category']) && $_POST['category'] == $catid))
echo ' selected="selected"';
echo '>' . $catname . '</option>';
$i++;
}
?>
</select>
edit: The htmlentities() function just converts HTML entities, like dobule quotes, ampersands (&) and other things like that, to XHTML compliant characters, like & quot; and & amp;. It will make sure that your inputs do not incorrectly "break" because someone entered a quote in their text.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|