Advertisement

12.03.2004 at 01:58PM PST, ID: 21229842
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.8

Sending Array Data in a POST

Asked by EmpKent in PHP Scripting Language

Tags: , , ,

What I am trying to do is have a form that when a user selects a category, then a sub category expands. In the subcategories, they can select any checkbox representing data that they want to be carried over to the next page. I tried to name the checkbox with a number incrementation concatenated behind it. But then I wasn't sure what to do with it on the next page and how to assign it to a variable when I didnt' know the exact name. So if someone can tell me how to do that, that would be great.

Otherwise, I think I have to use an array. But I am not too sure what I am doing wrong with it. I have a loop on my page that puts data into an array called commarray. Then I have a hidden field at that has this array data assigned to it.

In the form this is what I have:

for($i = 0; $i < $commrows; ++$i)
{
      $commline = odbc_fetch_array($commresult);
        ?>
               <input type='checkbox' name='<?PHP echo 'commtopic'.$i ?>' value='<?PHP echo $commline[Topic] ?>' ><?PHP echo $commline[Topic]; ?> <br>
      <div id="<?PHP echo $num ?>" class="switchcontent"><blockquote>
      <?PHP
      $commarray = array($i => '$commline[Topic]');
      ?>
      </blockquote></div>            
      <?PHP
}
?>
<input type='hidden' name='commarray' value='<?PHP echo $commarray ?>'>

On the next page, I have the following:

$commarray = $_REQUEST['commarray'];
$arraycount = count($commarray);
//I get an error on this - Warning: array_values(): The argument should be an array in /data/www/html/EROS/ReviewVariables.include on line 21
$arrayvalues = array_values($commarray);
print "<br>$arrayvalues";

print "<br>$commarray"; //Prints 'Array'
print "<br>$arraycount"; //Prints '1' (when their should be 7)
print "<br>$commarray[0]"; //Prints 'A' - I am not sure where it is getting A from - it is supposed to be a sentence


So I am not sure why this array is not getting passsed to the next page properly. What am I donig wrong?

Thanks
Start Free Trial
[+][-]12.03.2004 at 02:16PM PST, ID: 12740898

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: PHP Scripting Language
Tags: array, post, send, php
Sign Up Now!
Solution Provided By: hernst42
Participating Experts: 1
Solution Grade: A
 
 
[+][-]12.03.2004 at 02:26PM PST, ID: 12740960

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.03.2004 at 02:48PM PST, ID: 12741121

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.06.2004 at 09:02AM PST, ID: 12755902

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-42