You are here: Re: Storing array in a row « PHP Programming Language « IT news, forums, messages
Re: Storing array in a row

Posted by Jerry Stuckle on 10/13/36 11:47

guitarromantic@gmail.com wrote:
> Thanks for the tips everyone, I've been experimenting.
>
> Following this tutorial:
> http://www.zend.com/zend/spotlight/code-gallery-wade7.php
>
> I've made a several-step form to simplify the submissions.
>
> Page 1: User selects the relevant authors from a list box.
> Page 2: A form is populated for each item in the author array, like so:
>
> "Review for author $author"
> [textarea for review]
>
> I then pass these values to the final page (as the Zend tutorial
> suggests, with the fieldforwarder class). My issue then is that I want
> to use their code but I'm using an array within an array:
>
> foreach ($author as $value) {
> echo "Review for author $value<br>\n";
> echo "<textarea name=\"review_$value\" cols=\"32\"
> rows=\"6\"></textarea><br>\n";
> }
>
> The code the Zend tutorial gives for the final page is like this:
>
> $review = htmlentities($_POST['cust_name']);
>
> How can I grab the values for the reviews placed in the textarea using
> this method?
>

Just like Zend tells you.

Whatever is the name of your text area becomes the key to the $_POST array. In
their case they had an input field named 'cust_name'.

Since you (probably) have multiple text areas, you can either give them unique
names such as 'comment_1', "comment_2', etc. Or, a simpler approach would be to
name them all 'comment[]', in which case the $_POST['comment'] will be an array
with one element for each text area.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

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

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