You are here: Re: How to retrieve the text of a drop down list after a POST? « PHP Programming Language « IT news, forums, messages
Re: How to retrieve the text of a drop down list after a POST?

Posted by David Haynes on 03/26/06 05:47

Zorro wrote:
> Yes, you are correct. After the post, I know the value (ex : H ) and I need
> the text also. Then I do a SELECT col2 FROM myTable WHERE COL1 = 'H'
>
> I wanted to avoid doing this query by passing both the value and the text
> through the post.
>
> Denis
>
> "rlee0001" <robeddielee@hotmail.com> a écrit dans le message de news:
> 1143288409.220675.136750@g10g2000cwb.googlegroups.com...
>> Let me make sure I understand the problem correctly.
>>
>> Your table in your database looks like this?:
>>
>> COL1 COL2
>> H Hello
>> G Good-Bye
>>
>> And you are using Col1 (H or G) as a key into the table and you want to
>> know how to read the other columns from the table when the form is
>> submitted? Is that correct?
>>
>> -Robert
>>
>
>

<form action="foo.php" method="POST">
<select name="foo">
<option value="G:Good-Bye">G</option>
<option value="H:Hello">H</option>
</select>
</form>

[foo.php]
<?php
if( isset($_POST['foo'] ) {
$values = explode(':', $_POST['foo']);
$col1 = $values[0];
$col2 = $values[1];
}
?>

Is this what you wanted?

-david-

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация