Jump to content


Parse data returned from form elements with the same name

  • Please log in to reply
1 reply to this topic

#1 gavn8r

  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 07 September 2006 - 02:41 AM

I'm really new to PHP coming over from ASP, so please forgive the ignorance.  But...

I have a flash form that sends data to a php file.  The problem is that I can't modify the flash form because I don't have the .fla file anymore.  When I get the data, I first use this code (given to me graciously by a member of this forum):

//foreach ($_POST as $fld => $val) echo "$fld  = $val,<br>";

It returns, for example:
emailVariables = My Namemyemail@domain.com(555) 555-1212California

You can see that name, email, telephone number and state are all returned from a form element called emailVariables.  My problem is that I can't divide the data because there are no delimiters.  I'm wondering if there is a way to divide the data into separate variable names even though they all come from form elements with the same name?

#2 AndyB

  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 07 September 2006 - 02:54 AM

My problem is that I can't divide the data because there are no delimiters

Which means there's no rational way to decipher where one variable ends and the next begins in the only and only string returned.  It's plausible that some creative coding code separate the state (since it's everything immediately after the numbers), and to separate the phone number out, and even separate out the domain but the nameemail username is inseparable, plus you're out of luck completely if someone submits with the phone number.
Legend has it that reading the manual never killed anyone.
My site

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users