Jump to content

Recommended Posts

Hello,

 

I'm trying to handle a return string (sent as a URL) from an attempted form submission where there has been a validation issue with the data submitted.

 

The return string looks something like:

 

www mydomain.com?error_attribute0=PHONE&error_value0=1234567&error_attribute1=EMAIL&error_value1=abcdefg etc...

 

Where error_attribute[ ] is the name of the form field which has not validated and error_value[ ] is the value for that field which was submitted.

 

The string also includes individual elements for each form field sent, named as the form field, so using the above example the complete string looks like:

 

www mydomain.com?error_attribute0=PHONE&error_value0=1234567&error_attribute1=EMAIL&error_value1=abcdefg&PHONE=1234567&EMAIL=abcdefg ...plus any other fields which didn’t invalidate.

 

I know there are a number of ways to handle this string and present the form to the user for revalidation – my question is what’s the best way to do it?

 

My idea is to present the form with the original values repopulated using session variables to save stripping them from the string, then to highlight the invalid fields based on variables manufactured using the error_attribute[ ] element.

 

I can grab the query string and parse this into an array, but am unsure on how to grab each occurrence of error_attribute[ ] and turn each one into a variable.

 

Help, or another way of solving this issue would be great!

 

I don’t control the system the form is being submitted to, my PHP skills are not advanced although I do understand the concept of Arrays, Variables etc...

 

Thanks!

 

Link to comment
https://forums.phpfreaks.com/topic/182820-handling-return-strings/
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.