Keep a variable and add a second in database field
Posted: Sun Jan 11, 2009 5:55 am
Hi,
To give an example first of a working code,
<?php
$package = explode("|",$slcustom32);
?>
New order:<select name="newcustom32" >
<option value=""><? if (empty($package[1])) { echo "Choose a package"; } else { echo $package[1]; } ?></option>
<option value="<?=$package[0]?>|Storage package B|" <? if ( $package[1] == "Storage package B|" ) { echo "selected"; } ?> >Storage package B</option>
The idea here, which works, is that if $package[0] exists in the database, then keep that and add $package[1] as Storage package B, and separate $package[0] and $package[1] by a |
Now, how can I do the same for a text field input? Must I use a str_replace for this one, or is this impossible to do?
To give an example first of a working code,
<?php
$package = explode("|",$slcustom32);
?>
New order:<select name="newcustom32" >
<option value=""><? if (empty($package[1])) { echo "Choose a package"; } else { echo $package[1]; } ?></option>
<option value="<?=$package[0]?>|Storage package B|" <? if ( $package[1] == "Storage package B|" ) { echo "selected"; } ?> >Storage package B</option>
The idea here, which works, is that if $package[0] exists in the database, then keep that and add $package[1] as Storage package B, and separate $package[0] and $package[1] by a |
Now, how can I do the same for a text field input? Must I use a str_replace for this one, or is this impossible to do?