SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Enthusiast dannbkk's Avatar
    Join Date
    Jan 2007
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Advanced / Submitting Information Form / Admin

    I am putting this form together that will call 5 different rows from the database in dropdown format.
    http://www.seo2webdesign.com/add_golf_tour.php

    Can anyone tell me a better way to call Days etc. I am trying to work out a system like this but have a dropdown to select Day1 , Day2 etc, all the way to Day 30 but it seems a little unfriendly this way.

    And I also want a certain output which i need help with that you can see down the bottom.

    Does anyone have any suggestions of what they would do?

    PHP Code:
    <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <table width="65%" border="0">
      <tr>
    <td>Heading</td>
        <td><textarea name="6" cols="70" rows="1" id="6"><?=$_POST['6'];?>
        </textarea></td>
        </tr>
      <tr>
        <td width="7%">Day 1 </td>
        <td width="47%"><select name="1" id="1">
          <?php
            $r 
    mysql_query("SELECT * FROM category WHERE cat_group = '1' ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
            while (
    $row mysql_fetch_assoc($r)) {
                echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
            }
            
    ?>
            </select>
        <input type="hidden" name="Date" value="<%=dteDate%>">
        <input name="showDate" type="text" style="width:200; position:absolute;" value="<%=dteShowDate%>" onClick="if(self.gfPop)gfPop.fPopRLCalendar(document.frm.Date,null,null,document.frm.showDate,null);return false;" readonly="true">
        <a href="#" onClick="if(self.gfPop)gfPop.fPopRLCalendar(document.frm.Date,null,null,document.frm.showDate,null);return false;"  title="Click to open calendar">&nbsp;</td>
        </tr>
      
      <tr>
        <td>Golf</td>
        <td><select name="2" id="2">
          <?php
            $r 
    mysql_query("SELECT * FROM category WHERE cat_group = '2' ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
            while (
    $row mysql_fetch_assoc($r)) {
                echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
            }
            
    ?>
        </select></td>
        </tr>
      <tr>
        <td>Sight</td>
        <td><select name="3" id="3">
          <?php
            $r 
    mysql_query("SELECT * FROM category WHERE cat_group = '3' ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
            while (
    $row mysql_fetch_assoc($r)) {
                echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
            }
            
    ?>
        </select></td>
        </tr>
      <tr>
        <td>Flight</td>
        <td><select name="4" id="4">
          <?php
            $r 
    mysql_query("SELECT * FROM category WHERE cat_group = '4' ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
            while (
    $row mysql_fetch_assoc($r)) {
                echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
            }
            
    ?>
        </select></td>
        </tr>
      <tr>
        <td>Hotel</td>
        <td><select name="5" id="5">
          <?php
            $r 
    mysql_query("SELECT * FROM category WHERE cat_group = '5' ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
            while (
    $row mysql_fetch_assoc($r)) {
                echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
            }
            
    ?>
            </select></td>
        </tr>
      <tr>
        <td>Day 2 </td>
        <td><select name="1" id="1">
            <?php
            $r 
    mysql_query("SELECT * FROM category WHERE cat_group = '1' ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
            while (
    $row mysql_fetch_assoc($r)) {
                echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
            }
            
    ?>
          </select>
            <input type="hidden" name="Date" value="<%=dteDate%>" />
            <input name="showDate" type="text" style="width:200; position:absolute;" value="<%=dteShowDate%>" onclick="if(self.gfPop)gfPop.fPopRLCalendar(document.frm.Date,null,null,document.frm.showDate,null);return false;" readonly="true" />
            <a href="#" onClick="if(self.gfPop)gfPop.fPopRLCalendar(document.frm.Date,null,null,document.frm.showDate,null);return false;"  title="Click to open calendar">&nbsp;</td>
      </tr>
      <tr>
        <td>Golf</td>
        <td><select name="2" id="2">
            <?php
            $r 
    mysql_query("SELECT * FROM category WHERE cat_group = '2' ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
            while (
    $row mysql_fetch_assoc($r)) {
                echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
            }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Sight</td>
        <td><select name="3" id="3">
            <?php
            $r 
    mysql_query("SELECT * FROM category WHERE cat_group = '3' ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
            while (
    $row mysql_fetch_assoc($r)) {
                echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
            }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Flight</td>
        <td><select name="4" id="4">
            <?php
            $r 
    mysql_query("SELECT * FROM category WHERE cat_group = '4' ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
            while (
    $row mysql_fetch_assoc($r)) {
                echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
            }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Hotel</td>
        <td><select name="5" id="5">
            <?php
            $r 
    mysql_query("SELECT * FROM category WHERE cat_group = '5' ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
            while (
    $row mysql_fetch_assoc($r)) {
                echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
            }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Day 3 </td>
        <td><select name="1" id="1">
            <?php
            $r 
    mysql_query("SELECT * FROM category WHERE cat_group = '1' ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
            while (
    $row mysql_fetch_assoc($r)) {
                echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
            }
            
    ?>
          </select>
            <input type="hidden" name="Date" value="<%=dteDate%>" />
            <input name="showDate" type="text" style="width:200; position:absolute;" value="<%=dteShowDate%>" onclick="if(self.gfPop)gfPop.fPopRLCalendar(document.frm.Date,null,null,document.frm.showDate,null);return false;" readonly="true" />
            <a href="#" onClick="if(self.gfPop)gfPop.fPopRLCalendar(document.frm.Date,null,null,document.frm.showDate,null);return false;"  title="Click to open calendar">&nbsp;</td>
      </tr>
      <tr>
        <td>Golf</td>
        <td><select name="2" id="2">
            <?php
            $r 
    mysql_query("SELECT * FROM category WHERE cat_group = '2' ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
            while (
    $row mysql_fetch_assoc($r)) {
                echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
            }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Sight</td>
        <td><select name="3" id="3">
            <?php
            $r 
    mysql_query("SELECT * FROM category WHERE cat_group = '3' ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
            while (
    $row mysql_fetch_assoc($r)) {
                echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
            }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Flight</td>
        <td><select name="4" id="4">
            <?php
            $r 
    mysql_query("SELECT * FROM category WHERE cat_group = '4' ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
            while (
    $row mysql_fetch_assoc($r)) {
                echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
            }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Hotel</td>
        <td><select name="5" id="5">
            <?php
            $r 
    mysql_query("SELECT * FROM category WHERE cat_group = '5' ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
            while (
    $row mysql_fetch_assoc($r)) {
                echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
            }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Day 4 </td>
        <td><select name="1" id="1">
            <?php
            $r 
    mysql_query("SELECT * FROM category WHERE cat_group = '1' ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
            while (
    $row mysql_fetch_assoc($r)) {
                echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
            }
            
    ?>
          </select>
            <input type="hidden" name="Date" value="<%=dteDate%>" />
            <input name="showDate" type="text" style="width:200; position:absolute;" value="<%=dteShowDate%>" onclick="if(self.gfPop)gfPop.fPopRLCalendar(document.frm.Date,null,null,document.frm.showDate,null);return false;" readonly="true" />
            <a href="#" onClick="if(self.gfPop)gfPop.fPopRLCalendar(document.frm.Date,null,null,document.frm.showDate,null);return false;"  title="Click to open calendar">&nbsp;</td>
      </tr>
      <tr>
        <td>Golf</td>
        <td><select name="2" id="2">
            <?php
            $r 
    mysql_query("SELECT * FROM category WHERE cat_group = '2' ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
            while (
    $row mysql_fetch_assoc($r)) {
                echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
            }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Sight</td>
        <td><select name="3" id="3">
            <?php
            $r 
    mysql_query("SELECT * FROM category WHERE cat_group = '3' ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
            while (
    $row mysql_fetch_assoc($r)) {
                echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
            }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Flight</td>
        <td><select name="4" id="4">
            <?php
            $r 
    mysql_query("SELECT * FROM category WHERE cat_group = '4' ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
            while (
    $row mysql_fetch_assoc($r)) {
                echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
            }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Hotel</td>
        <td><select name="5" id="5">
    <?php
            $r 
    mysql_query("SELECT * FROM category WHERE cat_group = '5' ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
            while (
    $row mysql_fetch_assoc($r)) {
                echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
            }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td colspan="2"><table width="200" border="0" cellpadding="0">
          <tr>
            <td>Cost</td>
            <td><textarea name="7" cols="70" rows="1" id="7"><?=$_POST['7'];?>
            </textarea></td>
          </tr>
        </table></td>
        </tr>
      
      <tr>
        <td><table width="48" border="0" cellpadding="3">
          <tr>
            <td width="38"><input name="submit" type="submit" id="submit" value="Add" /></td>
            </tr>
        </table>
          <label></label>
          <?php
    if (isset($_POST['submit'])) {
    $a $_POST['1'];
    $b $_POST['2'];
    $c $_POST['3'];
    $d $_POST['4'];
    $e $_POST['5'];
    $f nl2br($_POST['6']);
    $g nl2br($_POST['7']);
    #if ($a == '' || $b == '' || $c == '' || $d == '' || $e == '') {
    #   echo '<center><font color="#FF0000">Please fill up all the blanks!</font></center>';
    #} 
    #else{
        
    mysql_query("INSERT INTO information (category, golf, sight, flight, hotel, info, cost)
                                      VALUES ('
    $a', '$b', '$c', '$d', '$e', '$f', $g')") or die("MySQL Error: ".mysql_error());
        echo 
    '<center><font color="#008000">Business successfully added into the list!</font></center>';
    #}
    }
    ?>
    Output I want is simply like this;
    This is corresponding with the following tables
    ;

    info (table)
    5 days/ 4 nights Bangkok – Hua Hin – Chiang Mai – Phuket Golf Holiday Package for Mr. and Mrs. Lewis

    category, golf, sight, flight (tables)
    Day 1, Sunday October 21: arrive Bangkok (QR 612, 07:20), transfer to your hotel
    Day 2, Monday October 22: half day city tour including visit to Grand Palace
    Day 3, Tuesday October 23: golf at Thai Country Club (site of Tiger Woods PGA Victory in 1997, best clubhouse in Asia)
    Day 4, Wednesday October 24: free day, at your own leisure shopping and at relaxing at pool
    Day 5, Thursday October 25: golf at Mission Hills Kanchanaburi (Jack Nicklaus design), transfer to River Kwai, check in your hotel


    This is corresponding with the following tables;
    hotel
    (table)
    Inclusive of following:
    -- 4 Nights accommodation in Bangkok at 5-star Shangri La Hotel, superior room, excluding daily breakfast
    -- 3 Nights accommodation in Kanchanaburi at 4-star Felix Resort, superior room, including daily breakfast
    -- 6 Nights accommodation in Hua Hin at 4-star Holiday Inn Beach Resort, standard room, including daily breakfast
    -- 6 nights accommodation in Chiang Mai at 4-star Imperial Mae Ping Hotel, superior room, including daily breakfast
    -- 8 nights accommodation in Phuket at 5-star Le Royal Meriden Yacht Club, ocean front deluxe room, including daily breakfast

    cost (table)
    All green fee, accommodation & transport costs based on 2 golfers:
    Special offer, per person, double occupancy = 188,440 Thai Baht
    Last edited by dannbkk; Jun 22, 2007 at 20:01.
    Learn SEO - Join the community at GSEO.net
    SEO Book - SEO Revenge eBook
    Make Money Programs - No Fluff!
    Make Money Online

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You should pull out the rows you need from that category table with a single query, not hit it 30 times in one page. Throw the results into an array to use throughout your page.

  3. #3
    SitePoint Enthusiast dannbkk's Avatar
    Join Date
    Jan 2007
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thats what I want.....How do i do that?
    Learn SEO - Join the community at GSEO.net
    SEO Book - SEO Revenge eBook
    Make Money Programs - No Fluff!
    Make Money Online

  4. #4
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    //read all the categories you need at once
    $r mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }

    //Later on, when you want to print out just one group
    //For example, the rows for cat_group 1
    foreach ($categories[1] as $row) {
      echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';


  5. #5
    SitePoint Enthusiast dannbkk's Avatar
    Join Date
    Jan 2007
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok I just did a find and replace for the top code you suggested and it now gives me this;
    http://www.seo2webdesign.com/add_golf_tour2.php
    (Its not grabbing it correctly)
    Last edited by dannbkk; Jun 22, 2007 at 22:59.
    Learn SEO - Join the community at GSEO.net
    SEO Book - SEO Revenge eBook
    Make Money Programs - No Fluff!
    Make Money Online

  6. #6
    SitePoint Enthusiast dannbkk's Avatar
    Join Date
    Jan 2007
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It looks like im not getting any answers from anyone?
    Learn SEO - Join the community at GSEO.net
    SEO Book - SEO Revenge eBook
    Make Money Programs - No Fluff!
    Make Money Online

  7. #7
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    Well it is the weekend!
    Post the code in full that you have now with Dan's additions.
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  8. #8
    SitePoint Enthusiast dannbkk's Avatar
    Join Date
    Jan 2007
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Before;
    http://www.seo2webdesign.com/add_golf_tour.php

    After;
    http://www.seo2webdesign.com/add_golf_tour2.php

    PHP Code:
    <?php echo $_SERVER['PHP_SELF']; ?>">
    <table width="65%" border="0">
      <tr>
        <td>Heading</td>
        <td><textarea name="6" cols="70" rows="1" id="6"><?=$_POST['6'];?>
        </textarea></td>
        </tr>
      <tr>
        <td width="7%">Day 1 </td>
        <td width="47%"><select name="1" id="1"><?php
    $r 
    mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }
    //Later on, when you want to print out just one group
    //For example, the rows for cat_group 1
    foreach ($categories[1] as $row) {
      echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
    }
            
    ?>
            </select>
        <input type="hidden" name="Date" value="<%=dteDate%>">
        <input name="showDate" type="text" style="width:200; position:absolute;" value="<%=dteShowDate%>" onClick="if(self.gfPop)gfPop.fPopRLCalendar(document.frm.Date,null,null,document.frm.showDate,null);return false;" readonly="true">
        <a href="#" onClick="if(self.gfPop)gfPop.fPopRLCalendar(document.frm.Date,null,null,document.frm.showDate,null);return false;"  title="Click to open calendar">&nbsp;</td>
        </tr>
      
      <tr>
        <td>Golf</td>
        <td><select name="2" id="2">        <?php
    $r 
    mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }
    //Later on, when you want to print out just one group
    //For example, the rows for cat_group 1
    foreach ($categories[2] as $row) {
      echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
    }
            
    ?>
        </select></td>
        </tr>
      <tr>
        <td>Sight</td>
        <td><select name="3" id="3"><?php
    $r 
    mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }
    //Later on, when you want to print out just one group
    //For example, the rows for cat_group 1
    foreach ($categories[3] as $row) {
      echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
    }
            
    ?>
        </select></td>
        </tr>
      <tr>
        <td>Flight</td>
        <td><select name="4" id="4"><?php
    $r 
    mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }
    //Later on, when you want to print out just one group
    //For example, the rows for cat_group 1
    foreach ($categories[4] as $row) {
      echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
    }
            
    ?>
        </select></td>
        </tr>
      <tr>
        <td>Hotel</td>
        <td><select name="5" id="5"><?php
    $r 
    mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }
    //Later on, when you want to print out just one group
    //For example, the rows for cat_group 1
    foreach ($categories[5] as $row) {
      echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
    }
            
    ?>
            </select></td>
        </tr>
      <tr>
        <td>Day 2 </td>
        <td><select name="1" id="1"><?php
    $r 
    mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }
    //Later on, when you want to print out just one group
    //For example, the rows for cat_group 1
    foreach ($categories[1] as $row) {
      echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
    }
            
    ?>
          </select>
            <input type="hidden" name="Date" value="<%=dteDate%>" />
            <input name="showDate" type="text" style="width:200; position:absolute;" value="<%=dteShowDate%>" onclick="if(self.gfPop)gfPop.fPopRLCalendar(document.frm.Date,null,null,document.frm.showDate,null);return false;" readonly="true" />
            <a href="#" onClick="if(self.gfPop)gfPop.fPopRLCalendar(document.frm.Date,null,null,document.frm.showDate,null);return false;"  title="Click to open calendar">&nbsp;</td>
      </tr>
      <tr>
        <td>Golf</td>
        <td><select name="2" id="2">        <?php
    $r 
    mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }
    //Later on, when you want to print out just one group
    //For example, the rows for cat_group 1
    foreach ($categories[2] as $row) {
      echo 
    '<option value="'.$row['id'].'">'.$row['title'].'</option>';
    }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Sight</td>
        <td><select name="3" id="3"><?php
    $r 
    mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Flight</td>
        <td><select name="4" id="4"><?php
    $r 
    mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Hotel</td>
        <td><select name="5" id="5"><?php
    $r 
    mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Day 3 </td>
        <td><select name="1" id="1"><?php
    $r 
    mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }
            
    ?>
          </select>
            <input type="hidden" name="Date" value="<%=dteDate%>" />
            <input name="showDate" type="text" style="width:200; position:absolute;" value="<%=dteShowDate%>" onclick="if(self.gfPop)gfPop.fPopRLCalendar(document.frm.Date,null,null,document.frm.showDate,null);return false;" readonly="true" />
            <a href="#" onClick="if(self.gfPop)gfPop.fPopRLCalendar(document.frm.Date,null,null,document.frm.showDate,null);return false;"  title="Click to open calendar">&nbsp;</td>
      </tr>
      <tr>
        <td>Golf</td>
        <td><select name="2" id="2">        <?php
    $r 
    mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Sight</td>
        <td><select name="3" id="3"><?php
    $r 
    mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Flight</td>
        <td><select name="4" id="4"><?php
    $r 
    mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Hotel</td>
        <td><select name="5" id="5"><?php
    $r 
    mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Day 4 </td>
        <td><select name="1" id="1"><?php
    $r 
    mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }
            
    ?>
          </select>
            <input type="hidden" name="Date" value="<%=dteDate%>" />
            <input name="showDate" type="text" style="width:200; position:absolute;" value="<%=dteShowDate%>" onclick="if(self.gfPop)gfPop.fPopRLCalendar(document.frm.Date,null,null,document.frm.showDate,null);return false;" readonly="true" />
            <a href="#" onClick="if(self.gfPop)gfPop.fPopRLCalendar(document.frm.Date,null,null,document.frm.showDate,null);return false;"  title="Click to open calendar">&nbsp;</td>
      </tr>
      <tr>
        <td>Golf</td>
        <td><select name="2" id="2">        <?php
    $r 
    mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Sight</td>
        <td><select name="3" id="3"><?php
    $r 
    mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Flight</td>
        <td><select name="4" id="4"><?php
    $r 
    mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Hotel</td>
        <td><select name="5" id="5"><?php
    $r 
    mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Day 5</td>
        <td><select name="1" id="1"><?php
    $r 
    mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }
            
    ?>
          </select>
            <input type="hidden" name="Date" value="<%=dteDate%>" />
            <input name="showDate" type="text" style="width:200; position:absolute;" value="<%=dteShowDate%>" onclick="if(self.gfPop)gfPop.fPopRLCalendar(document.frm.Date,null,null,document.frm.showDate,null);return false;" readonly="true" />
            <a href="#" onClick="if(self.gfPop)gfPop.fPopRLCalendar(document.frm.Date,null,null,document.frm.showDate,null);return false;"  title="Click to open calendar">&nbsp;</td>
      </tr>
      <tr>
        <td>Golf</td>
        <td><select name="2" id="2">        <?php
    $r 
    mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Sight</td>
        <td><select name="3" id="3"><?php
    $r 
    mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Flight</td>
        <td><select name="4" id="4"><?php
    $r 
    mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td>Hotel</td>
        <td><select name="5" id="5"><?php
    $r 
    mysql_query("SELECT * FROM category WHERE cat_group IN (1, 2, 3, 4, 5) ORDER BY id ASC") or die("MySQL Error: ".mysql_error());
    while (
    $row mysql_fetch_assoc($r)) {
      
    $group_id $row['cat_group'];
      
    $categories[$group_id][] = $row;
    }
            
    ?>
        </select></td>
      </tr>
      <tr>
        <td colspan="2"><table width="200" border="0" cellpadding="0">
          <tr>
            <td>Cost</td>
            <td><textarea name="7" cols="70" rows="1" id="7"><?=$_POST['7'];?>
            </textarea></td>
          </tr>
        </table></td>
        </tr>
      
      <tr>
        <td><table width="48" border="0" cellpadding="3">
          <tr>
            <td width="38"><input name="submit" type="submit" id="submit" value="Add" /></td>
            </tr>
        </table>
          <label></label>
          <?php
    if (isset($_POST['submit'])) {
    $a $_POST['1'];
    $b $_POST['2'];
    $c $_POST['3'];
    $d $_POST['4'];
    $e $_POST['5'];
    $f nl2br($_POST['6']);
    $g nl2br($_POST['7']);
    #if ($a == '' || $b == '' || $c == '' || $d == '' || $e == '') {
    #   echo '<center><font color="#FF0000">Please fill up all the blanks!</font></center>';
    #} 
    #else{
        
    mysql_query("INSERT INTO information (category, golf, sight, flight, hotel, info, cost)
                                      VALUES ('
    $a', '$b', '$c', '$d', '$e', '$f', '$g')") or die("MySQL Error: ".mysql_error());
        echo 
    '<center><font color="#008000">Business successfully added into the list!</font></center>';
    #}
    }
    ?></td>
        <td>&nbsp;</td>
      </tr>
    </table>
    Last edited by dannbkk; Jun 23, 2007 at 20:18.
    Learn SEO - Join the community at GSEO.net
    SEO Book - SEO Revenge eBook
    Make Money Programs - No Fluff!
    Make Money Online

  9. #9
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You have to put in a *little bit* of effort Try to understand what the code does, and read the comments I wrote that explain just that. Then you'll see why what you did is wrong.

  10. #10
    SitePoint Enthusiast dannbkk's Avatar
    Join Date
    Jan 2007
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok I have really put my head down and done the code exactly as you suggested and works:
    http://www.seo2webdesign.com/add_golf_tour2.php

    But I dont understand the logic of your suggestion as I dont think this is what I am trying to do. In the dropdowns they have duplicated themselves too many times. All i need is a simple system that can output each dropdown selection all the way to 30 days for 30 activities x 1 activity per output/ 1 activity per day.

    So for example:
    Day 1 we want Golf,
    Day 2 we want Hotel
    Day3 we want Golf
    Day 4 we want Sight
    Day 5 we want Hotel
    Day 6 we want flight
    Day 7 we want Golf
    Day 8 we want Golf
    etc. etc....

    We want to select 1 activity per day, thats all....

    I still think my first form is looking closer to what I want;
    http://www.seo2webdesign.com/add_golf_tour.php

    Unless you can prove me otherwise... Maybe im just not understanding your logic...
    Learn SEO - Join the community at GSEO.net
    SEO Book - SEO Revenge eBook
    Make Money Programs - No Fluff!
    Make Money Online

  11. #11
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    for ($i 1$i <= 30$i++) {
      
    //put all the code for displaying all the options for a single day here
      //with form inputs named uniquely


  12. #12
    SitePoint Enthusiast dannbkk's Avatar
    Join Date
    Jan 2007
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I dont want to have a drop down menu like i said for Days, I just want it set on Day 1 , and set on Day 2 on the next row etc. Infact I will probably take out the Day Table inorder to do that, but would you suggest that is a good idea? - will this effect me if when I click submit/add at the bottom of the form? Sometimes I will only want to print out 30 days sometimes I might want to print out 10 days, depending... see what im getting at here?

    and if so... What type of array is good to use to have each day already set

    But is the rest look ok inorder to print this type of seniario?

    5 days/ 4 nights Bangkok – Hua Hin – Chiang Mai – Phuket Golf Holiday Package for Mr. and Mrs. Lewis

    Day 1, Sunday October 21: arrive Bangkok (QR 612, 07:20), transfer to your hotel
    Day 2, Monday October 22: half day city tour including visit to Grand Palace
    Day 3, Tuesday October 23: golf at Thai Country Club (site of Tiger Woods PGA Victory in 1997, best clubhouse in Asia)
    Day 4, Wednesday October 24: free day, at your own leisure shopping and at relaxing at pool
    Day 5, Thursday October 25: golf at Mission Hills Kanchanaburi (Jack Nicklaus design), transfer to River Kwai, check in your hotel

    Inclusive of following:
    4 Nights accommodation in Bangkok at 5-star Shangri La Hotel, superior room, excluding daily breakfast
    3 Nights accommodation in Kanchanaburi at 4-star Felix Resort, superior room, including daily breakfast
    6 Nights accommodation in Hua Hin at 4-star Holiday Inn Beach Resort, standard room, including daily breakfast
    6 nights accommodation in Chiang Mai at 4-star Imperial Mae Ping Hotel, superior room, including daily breakfast
    8 nights accommodation in Phuket at 5-star Le Royal Meriden Yacht Club, ocean front deluxe room, including daily breakfast

    All green fee, accommodation & transport costs based on 2 golfers:
    Special offer, per person, double occupancy = 188,440 Thai Baht
    Learn SEO - Join the community at GSEO.net
    SEO Book - SEO Revenge eBook
    Make Money Programs - No Fluff!
    Make Money Online


Bookmarks

Posting Permissions

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