Hello everybody.
I am sorry to post a seemingly easy question, but I have not been able to find an example of this anywhere (lots of examples exist for text boxes ...).
I have a select box on one page that gets data out of a postges database using php. The select box is in a form. When I click submit I would like to get the value that was in the select box and echo it on the screen. Cold someone please help me with this.
Thank you for your help
Peter.
PS. This is what I was trying. It
worked for a text box.
main page
<select id="sel3" style="WIDTH: 173px;" multiple size="5" name="sel3">
<option selected=0 value=0>ALL</option>
<?php
$qryPrice = "SELECT price FROM tbl_price;";
$rstPrice = pg_query($connection, $qryPrice) or die("Error in query: $qryPrice. " . pg_last_error($connection));
$rowPrice = pg_num_rows($rstPrice);
for ($i=0; $i<$rowPrice; $i++)
{
$rowPrice = pg_fetch_array($rstPrice, $i, PGSQL_ASSOC);
?>
<option value='<? $i ?>'><?php echo $rowPrice['price']; ?></option>
<?php
}
?>
responce page
<?php echo $_POST["sel1"]; ?>.<br />This should have been posted in the sub-forum PHP. You'd get more responses there.Originally posted by afterburn
This should have been posted in the sub-forum PHP. You'd get more responses there.
moved and double moved
if you're trying to figure out what double moved means, I wouldn't bother - if it such an advanced theory that none but the greatest minds in the world can understand it.
MWHAHAHAHAHAHAHAThanks. I did not know there were sub forums.
PeterOriginally posted by putts
MWHAHAHAHAHAHAHA
Is that your insane leprechaun laugh?<select id="sel3" style="WIDTH: 173px;" multiple size="5" name="sel3">
<option selected=0 value=0>ALL</option>
<?php echo $_POST["sel1"]; ?>.<br />
the bold has to match. you need to get the "name" of the form element that you want.
also the red is invalid. either use:
selected
or
selected="selected"
I am sorry to post a seemingly easy question, but I have not been able to find an example of this anywhere (lots of examples exist for text boxes ...).
I have a select box on one page that gets data out of a postges database using php. The select box is in a form. When I click submit I would like to get the value that was in the select box and echo it on the screen. Cold someone please help me with this.
Thank you for your help
Peter.
PS. This is what I was trying. It
worked for a text box.
main page
<select id="sel3" style="WIDTH: 173px;" multiple size="5" name="sel3">
<option selected=0 value=0>ALL</option>
<?php
$qryPrice = "SELECT price FROM tbl_price;";
$rstPrice = pg_query($connection, $qryPrice) or die("Error in query: $qryPrice. " . pg_last_error($connection));
$rowPrice = pg_num_rows($rstPrice);
for ($i=0; $i<$rowPrice; $i++)
{
$rowPrice = pg_fetch_array($rstPrice, $i, PGSQL_ASSOC);
?>
<option value='<? $i ?>'><?php echo $rowPrice['price']; ?></option>
<?php
}
?>
responce page
<?php echo $_POST["sel1"]; ?>.<br />This should have been posted in the sub-forum PHP. You'd get more responses there.Originally posted by afterburn
This should have been posted in the sub-forum PHP. You'd get more responses there.
moved and double moved
if you're trying to figure out what double moved means, I wouldn't bother - if it such an advanced theory that none but the greatest minds in the world can understand it.
MWHAHAHAHAHAHAHAThanks. I did not know there were sub forums.
PeterOriginally posted by putts
MWHAHAHAHAHAHAHA
Is that your insane leprechaun laugh?<select id="sel3" style="WIDTH: 173px;" multiple size="5" name="sel3">
<option selected=0 value=0>ALL</option>
<?php echo $_POST["sel1"]; ?>.<br />
the bold has to match. you need to get the "name" of the form element that you want.
also the red is invalid. either use:
selected
or
selected="selected"