Jump to content

Array from a form


Mundo

Recommended Posts

I've created a quotation form and some of the values are passed in an array (i've used jQuery to clone the form for necessary fields).

 

I currently have the following:

 

foreach ($_GET as $var => $value) { 							// Stick POST names into "$var" and the values into "$value"
if(!is_array($value)) {									// Test us $value contains and array (horse detials are an array everything else isn't)
	echo "<strong>$var:</strong> $value<br />\n";			// Echo out the customer detials and additional information
	}
else {												// If the value is an array....

		} 
	}
}

 

But i'm kind of stuck for ideas on how to echo out the rest of the details in the way i need it...

 

There are 6 arrays, I know I can do something like:

 

$array = $_GET['quote-details'];
    foreach($array as $detail) {
        echo "<strong>Detail:</strong> $detail<br />\n";
        }

 

But I have to do this  6 times...

 

I also want to sort these details in a logical manor, but again im a little stuck. So instead of it exporting like:

 

Detail1

Detail1

Detail1

Detail2

Detail2

Detail2

 

etc, I want it to export as:

 

Detail1

Detail2

 

Detail1

Detail2

 

If anyone can give me any help I would be VERY grateful!

 

Regards,

Mundo

Link to comment
https://forums.phpfreaks.com/topic/214083-array-from-a-form/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.