You are here: Re: Using a <SELECT> field on a Form « PHP Programming Language « IT news, forums, messages
Re: Using a <SELECT> field on a Form

Posted by The Natural Philosopher on 01/02/08 11:08

Alan M Dunsmuir wrote:
> Michael Fesser wrote:
>>
>> If these records are identified by a number for example, assign them to
>> the 'value' attribute of your select options:
>>
>> <select name="foo">
>> <option value="1">first name</option>
>> <option value="2">second name</option>
>> ...
>> </select>
>>
> I'm still missing the point here, I think.
>
> If a user selects 'John Smith', and I know that that is the record with
> value '37', how does that help me to access, say, his address and
> date-of-birth without going back to the database?
>
> Are you implying that I have to?

What you can do is when you set up the form, set up a bunch of hidden
input types..

e.g. <INPUT type="hidden" value="dob_<? echo $database_id ?>" >

Then if you know that the $id is 37, do

$mydob="dob_".$id;
$dob=$_POST[$mydob];

HOWEBVER since carting large amounts of data around an internet HTML
session is a huge order of magnitude slower than querying a local
database, I tend to keep data to a minimum in post variables and query
the database often instead.

 

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

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