|
Posted by Tyrone Slothrop on 10/13/71 11:23
On Sun, 7 Aug 2005 14:38:20 +0200, "The Legend" <inavlid@invalid.com>
wrote:
>hello,
>
> Maybe someone can help me out with this one where i am stuck where i solve
>this in html or other code?
>
>
>html/php and mysql using in a html form:
>
> <tr>
> <td><?php echo"<font face=$b_fontface
>size=$b_fontsize>";?>WoonPlaats :</td>
> </tr>
> <tr>
> <td><select name="plaats" size="1">
> <?
> $result = mysql_query("select * from regio_nl order by rplaats");
> while ( $row = mysql_fetch_array($result))
> {
> $my_column = $row["rplaats"];
> /*echo "<option
>value=\"".$row[rplaats]."\">".$row['rplaats']."</option>";*/
>
> echo("<option value='$my_column'>$my_column</option>");
> }
> ?>
>
> </select> <br> </td>
> </tr>
>
>i want the users to select the rplaats, display the selection but also put a
>connected variable (not displayed) from the query connected to rplaats into
>a variable parsing trough another page insert these variables into a table
>like this:
>
>$query = "INSERT INTO mb_advertentie (plaats, variable2) VALUES( '$plaats',
>'$variable2')";
>
>As i did not know where to post this, i did a Xposting if you dont mind.
Ed:
I am guessing what you are trying to accomplish here. I am assuming
that you want to pass two unique vars through one post var.
<tr>
<td><font face="<?=$b_fontface?>"
size="<?=$b_fontsize?>">WoonPlaats :</td>
</tr>
<tr>
<td><select name="plaats" size="1">
<?
$rs = mysql_query("select * from regio_nl order by rplaats");
while ($r = mysql_fetch_array($rs))
{?>
<option
value="<?=$r['rplaats']?>::<?=$r['var2']?>"><?$=r['rplaats']?></option>
<?
}
?>
</select><br></td>
</tr>
<?
list ($plaats, $var2) = split ("::", $_POST['plaats']);
$query = "INSERT INTO mb_advertentie (plaats, variable2) VALUES(
'$plaats', '$var2')";
All I have done is to add a delimeter (::) to the value of the option
and am splitting it on the other end.
[Back to original message]
|