pass an html array to another file through url

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bluestar
Forum Newbie
Posts: 13
Joined: Thu Mar 17, 2011 7:19 am

pass an html array to another file through url

Post by bluestar »

i want to pass an array in html anchor tag to php file ...and then shows it to the iframe something like facebook....but it dint work
code are something like that......
in html file:

Code: Select all

 <select name="value[]"multiple="multiple">
	<option value="val1">val1</option>
	<option value="val2">val2</option>
	<option value="val3">val3</option>
</select>
<a href="filename.php?val=value[]" target="ifram1">show</a>
<iframe src="file2.php" name="ifram1"></iframe
in filename.php codes are:

Code: Select all

$arr1=$_GET['val'];
print_r($arr1);
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: pass an html array to another file through url

Post by Christopher »

There are a number of problems in the code above.

- No space between name="value[]" and multiple="multiple"
- No form to submit the select.
- The syntax in the select is correct for passing arrays, but in your link sets "val" not "value" and sets it to the string "value[]"
- In filename.php it should be $_GET['value']
(#10850)
Post Reply