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
    Regular Coder che_anj's Avatar
    Join Date
    Aug 2006
    Location
    Philippines
    Posts
    157
    Thanks
    12
    Thanked 3 Times in 3 Posts

    I badly neede answers

    Heres the code:

    $query="select p.sub_code,p.term, from prosdetails p, subject s,prospectus r where p.prosno='$prosno' and p.sub_code=s.sub_code and r.prosno=p.prosno";
    $result=mysql_query($query);
    echo '<tr><td>Subjects</td><td></td><td>List of Prequisites to be add</td><td></td><td>Pre-requisites</td></tr>';
    while($row=mysql_fetch_array($result))
    {
    echo '<tr><td bgcolor="white">
    <input type="text" readonly="readonly" size="16" name="subcode[]"
    value="'.$row[sub_code].' "></td>

    <td>
    <select name="">
    echo "<option value='".$row[sub_code]."'>".$row[sub_code]."</option>";
    </select>
    </td>

    }

    Lets assume that there are 10 subjects results
    therefore there are 10 textboxes and 10 combo boxes

    Every textbox has 1 subject result, my Problem is in the 10 combo boxes I want that there are also 10 subjects every combo boxes.

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    So build your combo boxes after you've built your $row array from your database. You'll need to add an additional dimension to the $row array so you save every row you fetch.

    Also using $row[sub_code] is bad practice; you really need to enclose the index name in quotes.

  • #3
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Quote Originally Posted by che_anj
    I badly neede answers
    And I badly neede you to read our posting guidelines and rules.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster


  •  

    Posting Permissions

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