Jump to content

[SOLVED] PHP Post, can you store these variables into an array?


SchweppesAle

Recommended Posts

hi, I was wondering if it's possible to take all the input values then store them within array which I can pass onto a script which will handle it.

 

The reason I'm doing this is because I have a script which will generate a different number of "checkbox" input types depending on how large the database has grown and I'm not sure how to pull these values since you need to declare the name of each input.

 

ex:

$_GET["name"]

 

I figured that if I could store them all within a single array then there wouldn't be a problem.  Is there a better way of doing this?

 

edit:

just wanted you guys to get an idea of what I'm working with

<?php
global $mainframe;
$db =&JFactory::getDBO();
$query = "SELECT * FROM #__AuthorList";
$db->setQuery( $query, 0, $count );
$rows = $db->loadObjectList();
$number = 0;

echo "<form method='get' action='script name'>";
echo "<table border = 1 width = 500><tr><td>";
echo "<center><b>Primary List</b></center>";
echo "</td></tr>";
foreach($rows as $row)
{
if (($row -> stage) == 0  && (($row -> AuthorName) != LeaveBlank) && (($row -> AuthorName) != null))
{
echo "<tr><td>";
echo $row ->AuthorName;
echo "</td><td>";
echo "<input type='checkbox' name='".$row->AuthorID."' value='".$row->AuthorID."'>";
echo "</tr></td>";
}
}
echo "</table>";


echo "<p/>";

echo "<table border = 1 width = 500><tr><td>";
echo "<center><b>Secondary List</b></center>";
echo "</td></tr>";
foreach($rows as $row)
{
if (($row -> stage) == -1 && (($row -> AuthorName) != LeaveBlank2) && (($row -> AuthorName) != null))
{
echo "<tr><td>";
echo $row ->AuthorName;
echo "</td><td>";
echo "<input type='checkbox' name='".$row->AuthorID."' value='".$row->AuthorID."'>";
echo "</tr></td>";
}
}
echo "</table>";
echo "<p/>";
echo "<input type='hidden' name='number' value='".$number."'>"

echo "<INPUT type='submit' value='Switch Current List'>";
echo "</form>";




?>

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.