Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Sep 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    <SELECT> Help needed

    I am having a registration page here

    http://ntudebatingsociety.org/iv/register.php

    When a user select the No of teams, i use a for statement to display one table each for a team in the next page register2.php
    Quote:
    for ($i=1;$i<=$teams;$i++)
    {
    print'<p class=\"text\">Team&nbsp;&nbsp;';echo"$i";print'</p><table border=1 class=\"tablestructure\">
    <tr><td class=\"listtable\">Team Number</td><td><select name='.$teamselect.'[i]><option value=1>A</option>
    <option value=1>A</option>
    <option value=2>B</option>
    <option value=3>C</option>
    <option value=4>D</option>
    <option value=5>E</option>
    <option value=6>F</option>
    <option value=7>G</option>
    <option value=8>H</option>
    <option value=9>I</option>
    <option value=10>K</option>
    </select></td></tr>
    <tr><td class=\"listtable\">Member 1 Name</td><td><input type=text name=\"member1name\"></input></td></tr>
    <tr><td class=\"listtable\">Accommodation</td><td><select name=accomselect[]><option value=1>Dormitory</option><option value=2>Other</option></select></td></tr>
    <tr><td class=\"listtable\">Details</td><td><textarea name=detail[] cols=30 rows=5></textarea></td></tr>
    <tr><td></td></tr>
    <tr><td class=\"listtable\">Member 2 Name</td><td><input type=text name=\"member1name\"></input></td></tr>
    <tr><td class=\"listtable\">Accommodation</td><td><select name=accomselect[]><option value=1>Dormitory</option><option value=2>Other</option></select></td></tr>
    <tr><td class=\"listtable\">Details</td><td><textarea name=detail[] cols=30 rows=5></textarea></td></tr>
    </table><br>';

    }


    After he clicks submit, i execute the page finish.php and i need all the selected Team Numbers[eg A,B,C etc] of all the teams as an array or something so that i can mail the details.

    Is there any way to do this.. Can i pass the <select name= to an array> so that i can retrieve them in the next page using $_REQUEST['array'] ????

    any help would be appreciated.

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    welcome here!

    first off --> take a look at your current code:
    - if you print singlequoted-strings, then you don't need to escape double quotes
    - does $teamselect has a value? and was [i] meant to be a literal?
    - for your code, you'd better replace the print by an echo with multiple arguments.

    about your question: your not really clear on what you want. getting the team numbers as an array or something, so you can mail it kinda vague. do you also need the related data (like accomodation, details etc)?

    Assuming you only need the selected teams --> you could make an array of your hltm-field by using formfieldnames like
    PHP Code:
    echo '<select name="teamdetails[teamnumber]['$i ,']" ...> ... </select>'
    and you can then implode the selected values like this

    $arr_selected_teamnumbers = array_values($_POST['teamdetails['teamnumber']']));

    wich will get you an array of the selected teams.
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #3
    New to the CF scene
    Join Date
    Sep 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ..resolved....

    I set the teamarray to

    $teamarray = array(A, B, C, D, E, F,G, H, I, J, K);

    i called the select

    echo'</p><table border=1 class=\"tablestructure\">
    <tr><td class=\"listtable\">Team Number</td><td><select name=';echo $teamarray[$i];echo'><option ...

    next page
    $teamarray = array(A, B, C, D, E, F,G, H, I, J, K);
    and called all values using
    $HTTP_POST_VARS[$teamarray[$i]];

    a bit like u r code.. thanks for the info raf..


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •