SitePoint Sponsor

User Tag List

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

    Submit information into text box

    This code I have put together is meant to pull information from categories when the dropdown titles are selected and when add button is clicked it submits the information into the textarea field box,

    The problem is when add is clicked it is not?

    Where in my code is it wrong?

    PHP Code:
    <?php echo $_SERVER['PHP_SELF']; ?>">
    <table width="65%" border="0">
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        </tr>
      <tr>
        <td width="7%">Day</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 valign="top">Info</td>
        <td><textarea name="6" cols="100" rows="8" id="6"><?=$_POST['19'];?></textarea></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']);
    #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)
                                      VALUES ('
    $a', '$b', '$c', '$d', '$e', '$f')") or die("MySQL Error: ".mysql_error());
        echo 
    '<center><font color="#008000">Business successfully added into the list!</font></center>';
    #}
    }
    ?>
    Learn SEO - Join the community at GSEO.net
    SEO Book - SEO Revenge eBook
    Make Money Programs - No Fluff!
    Make Money Online

  2. #2
    SitePoint Member
    Join Date
    Jun 2007
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Too much code here for people to wade through. One tip that will make it much easier for you, though: try to gather your "business logic" code together at the start of your file, and then echo the results later on within your HTML. Also you'll find some simple echo statements to trace the code when Add is clicked of use.

  3. #3
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Really could not be clear what you need to have.
    The problem is when add is clicked it is not?
    What does that sentence say? Maybe i am weak in English. Sorry if so.

    Where is your form element named 19 which you have echoed in the textarea $_POST['19']? And what you want to exactly?
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  4. #4
    SitePoint Enthusiast dannbkk's Avatar
    Join Date
    Jan 2007
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok I am going to re-post this topic as I have slightly redesigned this code and also need different output, sometimes a little hard also to explain ill try my best in the next post
    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
  •