Re: [SMARTY] Quick question about checking form post variables / arrays

From: Date: Sun, 28 Jul 2002 06:28:21 +0000
Subject: Re: [SMARTY] Quick question about checking form post variables / arrays
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-5477@lists.php.net to get a copy of this message
On Sat, Jul 27, 2002 at 11:57:12PM -0400, Joao Prado Maia wrote: > I've been trying to figure out how to do what I'll explain here, but with > no success. If anyone can shed some light into this it would be very > appreciated. > > Ok, so in HTML you can just name your form elements field[] and that field > is turned into an array automatically on your PHP script. What I have been > trying to do is the following: > > <select name="category[]" multiple size="3"> > {section name="y" loop=$cats} <option value="{$cats[y].cat_id}" {if $id eq $cats[y].cat_id}SELECTED{/if}>{$cats[y].cat_title}</option> > {/section} > </select> Where $id is the value you want selected. > But if there is any information missing on the form, I make the same form > appear again to the user, with the information already filled out. While I > can easily just do the following for text fields: > > <input type="text" name="name" value="{$smarty.post.name}"> > > I don't know how to make the select box above have the appropriate options > selected by default. How do I check if that {$cats[i].cat_id} is inside > the $smaty.post.category variable in Smarty ? > > Joao > > -- > João Prado Maia <jpm@phpbrasil.com> > http://phpbrasil.com - php com um jeitinho brasileiro > -- > Precisando de consultoria em desenvolvimento para a Internet ? > Impleo - http://impleo.net/?lang=br > -- > Leia mais sobre os nossos serviços e produtos > http://impleo.net/products.php?lang=br > > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- --Sheldon ------------------------------------------------------ Sheldon Jones Systems Administrator Lobo Internet Services, Ltd. mailto:sheldon@hobbydump.com Does Microsoft mean "small and limp"? What's with the 'Intel Inside' warning label anyway? ------------------------------------------------------

« previous php.smarty.general (#5477) next »