Re: Question: Repopulating form parameters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



--- Jason Wong <php-general@xxxxxxxxxxxx> wrote:

> On Sunday 12 December 2004 18:15, Stuart Felenstein
> wrote:
> 
> > Still stuck on this one.  I know I'm doing
> something
> > wrong and wouldn't mind some correction:
> 
> Did you mockup some test HTML in a wysisyg editor as
> suggested?

Yep like this :

<select name="select" size="10" multiple>
        <option value="1" <?php if (!(strcmp(1,
"None"))) {echo "SELECTED";} ?>>Black</option>
        <option selected value="2" <?php if
(!(strcmp(2, "None"))) {echo "SELECTED";}
?>>Blue</option>
        <option value="3" <?php if (!(strcmp(3,
"None"))) {echo "SELECTED";} ?>>Red</option>
        <option value="4" <?php if (!(strcmp(4,
"None"))) {echo "SELECTED";} ?>>Orange</option>
        <option value="5" <?php if (!(strcmp(5,
"None"))) {echo "SELECTED";} ?>>Purple</option>
        <option selected value="6" <?php if
(!(strcmp(6, "None"))) {echo "SELECTED";}
?>>Brown</option>
      </select>

Problem is arrays are hanging me up.

> Did you compare the mockup HTML with that produced
> by your code above?

//mockup 
<option value="<?php echo
$row_rsInd['CareerIDs']?>"<?php if
(!(strcmp($row_rsInd['CareerIDs'], 2))) {echo
"SELECTED";} ?>><?php echo
$row_rsInd['CareerCategories']?></option>


//Attempt, problems with parsing errors:

<select name="Ind[]" size="8" multiple="multiple"
id="Ind[]" >
<?php
while($row = mysql_fetch_array($inds, MYSQL_BOTH)) {
echo '<option value="'.$row['CareerIDs'].'">';
if (!(strcmp($row_rsInd['CareerIDs'], '$Ind')));
{echo "SELECTED";}
.$row['CareerCategories'].'</option>';
}


Close but no cigar.  Since $Ind is already imploded my
thinking is it need not be incremented in the echo
statement ?

Stuart

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux