Jump to content

$_GET array?


mcfmullen

Recommended Posts

I have the following code in parser.php:

 

<?php

$xml = simplexml_load_file('differences.xml');

$object = $xml->xpath('//item');

$count = count($object);

$i = 0;

echo "<form method='get' action='parsed.php'>";

while($i < $count)
{

$objectname = $object[$i]['name'];
echo "<input type='checkbox' name='option".$i."' value='$objectname' checked>".$objectname;
echo "<br>";

$i++;

}

echo "<br><input type='submit' value='Proceed'><br>";
echo "</form>";
?>

 

This passes a url as such:

http://localhost/parsed.php?option0=dog&option1=cat&option2=fish

 

Now the thing is, I want to $_GET all this information, store it into a variable array and then manipulate it.

 

Essentially, parser.php displays a checklist of items inside differences.xml. The user can then choose what items to select or deselect in the form. Upon sending the form, parsed.php will display the full contents of XML data relating to the selected items. The user can then modify these items, and save them to the MySQL database.

 

Right now, I just need help to get parsed.php to display the names of all the objects passed into the form (see url).

 

This brings me back to my original question: how to store it into an array?

 

This way I can count the objects in the array, run a loop through the XML where items match the values in the array and so on.

 

Any help?

Link to comment
https://forums.phpfreaks.com/topic/222174-_get-array/
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.