Book Section
-----
TY JavaScript 3rd Ed.
Teach Yourself JS 1.5
Teach Yourself DHTML
Teach Yourself JS 1.3
LLWW: JavaScript

General Section
-----
Discussion Forum
Articles / Tips
JavaScript Links
About the Author
Privacy Policy
Contact Me



Other Sites
-----
Website Workshop
JavaScript Weblog

JavaScript Workshop Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Posting all selected options to PHP

 
Post new topic   Reply to topic    JSWorkshop Forum Index -> Server-Side Languages
View previous topic :: View next topic  
Author Message
phpPete
Member
Member


Joined: 07 Aug 2002
Posts: 32

PostPosted: Sat Sep 07, 2002 11:28 am    Post subject: Posting all selected options to PHP Reply with quote

Ok, due to PHP and JS naming restrictions I'm finding it exceedingly difficult, or perhaps I'm dense, to post multiple selected options from a select list.

If I name my form: name[] ( effectively declaring an array ) then PHP picks up all the selected options no problem, however, I need to process to do a number of things with JS before i post the form and JS doesn't like element names like: name[].

I tried something like this to no avail also:

<form name="f1" ...>
<select name="f1[choices[]]"...>

When i name like so PHP does get all the posted selections, however, i am unable to do my client side processing in JS with this sort of naming.

Can anyone help me out here?

Thanks,

Pete
Back to top
View user's profile Send private message Send e-mail
phpPete
Member
Member


Joined: 07 Aug 2002
Posts: 32

PostPosted: Sat Sep 07, 2002 12:22 pm    Post subject: Reply with quote

I found this on the Php site:
http://www.php.net/manual/en/faq.html.php#faq.html.select-multiple
Back to top
View user's profile Send private message Send e-mail
phil karras
Senior Member
Senior Member


Joined: 15 Jul 2002
Posts: 1776
Location: MD

PostPosted: Mon Sep 09, 2002 8:57 am    Post subject: Reply with quote

If you just "assume" that all posted options fill in an array in PHP you should be able to access them. At least I've tried it since one book I was reading said it worked that way and as I remember it did work that way.

That is NOT the only way to get data with PHP. As I remember PHP gets ALL data into an array structure and any & all data can then be accessed via it's own internal array.

Look at my JS/PHP web site for my PHP example which shows how to do this: http://www.jsworkshop.com/bb/viewtopic.php?t=147

The PHP test is on the 3rd row 3rd column of the link grid.
_________________
Phil K
Circle Software Consulting
Test website: http://cs.yrex.com/
Guidelines for Posting: http://www.jsworkshop.com/posting.html
IHBAAA = It Has Been Asked And Answered
KISS: http://www.jsworkshop.com/bb/viewtopic.php?t=508
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    JSWorkshop Forum Index -> Server-Side Languages All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group
(c) 1997-2002 Starling Technologies and Michael Moncur. Portions (c) Sams Publishing.