note 52711 added to faq.html

From: Date: Tue, 10 May 2005 17:10:53 +0000
Subject: note 52711 added to faq.html
Groups: php.notes 
Request: Send a blank email to php-notes+get-89217@lists.php.net to get a copy of this message
In your action, "random_picker_action.php" shouldn't you initialize $picks? The code didn't work for me until I added the line: $picks = $_REQUEST['picks']; Here is the full random_picker_action.php Yours, Noah <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>How to Pass an Array from Javascript to PHP: Action Page</title> <!-- File: random_picker_action.php --> </head> <body> <p> <h3>How to Pass an Array from Javascript to PHP: Action Page</h3> <?php $picks = $_REQUEST['picks']; $picks = urldecode(stripslashes($picks)); echo "<b>JavaScript said: " . $picks . "</b><p>"; $picks = unserialize($picks); if(sizeof($picks) > 0) { reset($picks); echo "You picked the following items:<p>"; while($item = each($picks)) echo $item['value'] . " off, " . str_replace("_", " ", $item['key']) . "<br>"; } else echo "You did not pick any items<p>"; ?> </body> </html> ---- Manual Page -- http://www.php.net/manual/en/faq.html.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+52711 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52711&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52711&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52711&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52711&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52711&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+52711&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#89217) next »