Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to carry array to another page

Status
Not open for further replies.

sunpraise

MIS
Joined
Jul 10, 2003
Messages
2
Location
US
Hi, all

I have a problem of carrying an array to another page. I'm trying to delete records with checked boxes on the first page which is "getStud.php",so on the form, i carry the variable of the array from here:

echo &quot;<form method=POST action=\&quot;deleteStud.php?arrs[]=&quot;.$arrs[].&quot;\&quot;>

$arrs[] is the array of the name of the check boxes. What I'm trying to do is similar to deleting the emails. You check the boxes in front of the emails and hit Delete button.

well, it didn't work. Help me please, thanks.
 
You need not attach anything to the URL, you are already using POST as a method.

Your checkboxes in the form have name attributes. Name them like this:
Code:
<input type=&quot;checkbox&quot; name=&quot;student[]&quot; value=&quot;value1&quot;>
<input type=&quot;checkbox&quot; name=&quot;student[]&quot; value=&quot;value3&quot;>
<input type=&quot;checkbox&quot; name=&quot;student[]&quot; value=&quot;value2&quot;>
You will be able to access the array on the receiving scripts' end using $_POST['student'] which will be an array.

Loop through that array using
Code:
foreach ($_POST['student'] as $key=>$value {
   # your code here processing $value

Hope this helps you get started.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top