mutiple posts into an array?

Discussion in 'PHP' started by headless, Jan 21, 2012.

  1. #1
    Hello All,

    Quick question, Ive got a large form that I want to post multiple values into a process form.

    The form comprises of 6 boxes that people need to fill in, for every item they select. So if the person picks 4 items there will be 24 boxes in total. Each group of six boxes need there information to be passed over together.

    I was thinking about creating an array for each of the six boxes and grouping them so position 1 in all of the arrays will be the right line. I have done some coding for it but the foreach loop wasn't setup correctly so It didn't work.

    $count=0;
    foreach($_POST['blogurl'] as $value)
    {
    $blogurl[$count] = $value;
    $count++;
    }
    $count=0;
    foreach($_POST['owner'] as $value)
    {
    $owner[$count] = $value;
    $count++;
    }
    $count=0;
    foreach($_POST['duration'] as $value)
    {
    $duration[$count] = $value;
    $count++;
    }
    $count=0;
    foreach($_POST['beforeanchor'] as $value)
    {
    $beforeanchor[$count] = $value;
    $count++;
    }
    $count=0;
    foreach($_POST['anchor'] as $value)
    {
    $anchor[$count] = $value;
    $count++;
    }
    $count=0;
    foreach($_POST['afteranchor'] as $value)
    {
    $afteranchor[$count] = $value;
    $count++;
    }
    $count=0;
    foreach($_POST['siteurl'] as $value)
    {
    $siteurl[$count] = $value;
    $count++;
    }
    Code (markup):
    Does anyone have a way that I could do this??

    Any help/point in the right direction would be much appreciated
     
    Solved! View solution.
    headless, Jan 21, 2012 IP
  2. #2
    Hi, Have you any primary value / key (i.e. user id)?
    If you have then you can set you html form like this -
    In PHP
    Hope, this one help you.
     
    anisbd, Jan 26, 2012 IP
  3. headless

    headless Well-Known Member

    Messages:
    732
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    140
    #3
    Thanks for the response when you put
    How do I output the values?
     
    headless, Jan 29, 2012 IP