Re: Arrays and Textareas

From: Date: Wed, 13 Sep 2000 18:33:55 +0000
Subject: Re: Arrays and Textareas
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-16619@lists.php.net to get a copy of this message
Weston, You can use hidden fields for text fields, too, but they could become big, unweildy and you'll have to escape some HTML characters (" comes to mind) to get it to send correctly. Alternatively, if the ultimate goal is a database, you could insert it, retrieve the new ID (mysql_insert_id() I think is what it's called, but I can never remember) and pass the ID. Then, you update based on that ID, instead of one big insert at the end. Maybe not the perfect way, but perhaps better than passing all that info in a hidden field? Hans On Wed, 13 Sep 2000, Weston Houghton wrote: > > Perfect solution sitting right in front of me, thank you. Now a secondary > question though... > > You can pass text fields through pages by just using hidden form fields, > does anyone have a recommendation on how to do this for textareas? > > Thanks again, > Wes > > > > > > Your input and textarea names are the same (tocElement). Try something > > like tocElement_input and tocElement_textarea to separate them. You can > > also 'force' the array to match, like this: > > > > inputs: > > > > tocElement_input[1] > > tocElement_input[2] > > tocElement_input[3] > > tocElement_input[4] > > > > tocElement_textarea[1] > > tocElement_textarea[2] > > tocElement_textarea[3] > > tocElement_textarea[4] > > > > The numbers can be generated by an index in a loop that you generate the > > number of fields with. > > > > On the submit page, when looping through the count of one array (either > > one), just use the same index number to get the value of the other array. > > > > BTW, I don't know if it hurts to use single quotes in HTML parameters, but > > I think it's good code to use doubles. > > > > Hans > > > > On Wed, 13 Sep 2000, Weston Houghton wrote: > > > >> > >> Hey, > >> > >> I'm trying to generate a dynamic number of input fields, each input field > >> with an associated textarea. If they were all input fields, I could throw > >> each field into an array. However, when I throw a textarea into the picture, > >> it seems to screw with the array elements. > >> > >> You can see this at: > >> http://mandalay.anapraxis.com/dev/adm_tocstart.php > >> > >> If you want to see the code, you can view any of the pages as *.txt > >> > >> I would appreciate any recommendations on how to approach this from here. > >> > >> Wes > >> > >> > >> > >> > > > -- Hans Anderson -=- me@hansanderson.com | PHP, SQL Databases, Flash 5 Animation http://www.hansanderson.com | & Programming, Killer Audio Production, http://www.goofiness.com | Search Engines, Brewmeister.

« previous php.general (#16619) next »