SitePoint Sponsor

User Tag List

Results 1 to 12 of 12

Threaded View

  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


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
  •