Jump to content

Parse data returned from form elements with the same name


gavn8r

Recommended Posts

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?
Link to comment
Share on other sites

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

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.