Having a problem...

  • kej0283
  • Novice
  • Novice
  • kej0283
  • Posts: 18

Post 3+ Months Ago

I have this form: Here's the code: My problem is that when I enter information into the form: its not going in to my results page: Down below is the results code.. I'm not getting errors in form. Can somebody help me please?? Thank you!
Code: [ Select ]
<head><style type="text/css" media="all"> @import "./includes/A4-kreiderCSS.css";</style></head>
<?php include ("header3.php") ?>
</div>
<?PHP
///////////////////////////////////// Start Dade and Time /////////////////////////////////
function eventscalendar(){
// Monts array
$months = array(1 => 'January', 'February', 'March', 'April', 'May',
  'June', 'July', 'August', 'September', 'October', 'November',
  'December');
        $times = array( '00:00:00'=> 'Midnight', '01:00:00' => '1am', '01:30:00' => '1:30am', '02:00:00' => '2am', '02:30:00' => '2:30am', '03:00:00' => '3am', '04:00:00' => '4am', '04:30:00' => '4:30am', '05:00:00' => '5am','053000' => '5:30am','060000' => '6am', '063000' => '6:30am', '070000' => '7am', '073000' => '7:30am', '080000' => '8am','083000' => '8:30am', '090000' => '9am','09:30:00' => '9:30am', '10:00:00' => '10am','10:30:00' => '10:30am', '11:00:00' => '11am','11:30:00' => '11:30am','12:00:00' => 'Noon', '12:30:00' => '12:30pm', '13:00:00' => '1pm', '13:30:00'=> '1:30pm', '14:00:00' => '2pm','14:30:00' => '2:30pm', '15:00:00' => '3pm','15:30:00' => '3:30pm', '16:00:00' => '4pm','16:30:00' => '4:30pm', '17:00:00' => '5pm','17:30:00' => '5:30pm', '18:00:00' => '6pm','18:30:00' => '6:30pm','19:00:00' => '7pm','19:30:00' => '7:30pm', '20:00:00' => '8pm','20:30:00' => '8:30pm','21:00:00' => '9pm','21:30:00' => '9:30pm', '22:00:00' => '10pm', '22:30:00' => '10:30pm','23:00:00' => '11pm','23:30:00' => '11:30pm');
  // pull doun menu
  echo '<select name="month">';
  echo '<option value="select month">Month</option>\n';
  foreach($months as $key => $value){
   echo "<option value=\"$key\"";
   if($_POST['month'] == $key && !isset($_POST['reset'])){
     echo ' selected="selected"';
   }
   echo ">$value</option>\n";
  }
  echo '</select>';

  echo '<select name="day">';
  echo '<option value="day">Day</option>\n';
  for($day = 1; $day <= 31; $day++){
   echo "<option value=\"$day\"";
   if($_POST['day'] == $day && !isset($_POST['reset'])){
     echo ' selected="selected"';
   }
   echo ">$day</option>\n";
  }
  echo '</select>';

  echo '<select name="year">';
  echo '<option value="year">Year</option>\n';
  $year = 2007;
  while($year <= 2015){
   echo "<option value=\"$year\"";
   if($_POST['year'] == $year && !isset($_POST['reset'])){
     echo ' selected="selected"';
   }
   echo ">$year</option>\n";
   $year++;
  }
  echo '</select>';

 echo '<select name="time">';
  echo '<option value="select t">Time</option>\n';
  foreach($times as $key => $value){
   echo "<option value=\"$key\"";
   if($_POST['time'] == $key && !isset($_POST['reset'])){
     echo ' selected="selected"';
   }
   echo ">$value</option>\n";
  }
  echo '</select>';
    }
    
?>
<?PHP

///////////////////////////////////// Start Dade and Time /////////////////////////////////
function endtime(){
// Monts array
    $timevalues = array( '00:00:00'=> 'Midnight', '01:00:00' => '1am', '01:30:00' => '1:30am', '02:00:00' => '2am', '02:30:00' => '2:30am', '03:00:00' => '3am', '04:00:00' => '4am', '04:30:00' => '4:30am', '05:00:00' => '5am','053000' => '5:30am','060000' => '6am', '063000' => '6:30am', '070000' => '7am', '073000' => '7:30am', '080000' => '8am','083000' => '8:30am', '090000' => '9am','09:30:00' => '9:30am', '10:00:00' => '10am','10:30:00' => '10:30am', '11:00:00' => '11am','11:30:00' => '11:30am','12:00:00' => 'Noon', '12:30:00' => '12:30pm', '13:00:00' => '1pm', '13:30:00'=> '1:30pm', '14:00:00' => '2pm','14:30:00' => '2:30pm', '15:00:00' => '3pm','15:30:00' => '3:30pm', '16:00:00' => '4pm','16:30:00' => '4:30pm', '17:00:00' => '5pm','17:30:00' => '5:30pm', '18:00:00' => '6pm','18:30:00' => '6:30pm','19:00:00' => '7pm','19:30:00' => '7:30pm', '20:00:00' => '8pm','20:30:00' => '8:30pm','21:00:00' => '9pm','21:30:00' => '9:30pm', '22:00:00' => '10pm', '22:30:00' => '10:30pm','23:00:00' => '11pm','23:30:00' => '11:30pm');
  

  // pull doun menu
 echo '<select name="t">';
  echo '<option value="t">Time</option>\n';
  foreach($timevalues as $key => $value){
   echo "<option value=\"$key\" ";
   if($_POST['t'] == $key && !isset($_POST['reset'])){
     echo ' selected="selected"';
   }
   echo ">$value</option>\n";
  }
  echo '</select>';
    }
?>
<?php
require_once("configproject.php");



if (!isset($_POST['reset']))
{
    if (isset($_POST['submitted']))
    {
        $errormsg = "";
        
        
        //check event is blank
        if (empty($_POST['event']))
        {
            $event = NULL;
                        $errormsg .="<p class = 'error'> Please fill in the event</p></span>";
        }
    
        else{
                $event = trim($_POST['event']);
        }
        
        //Checks the event_description shows error
        
                if (empty($_POST['event_description']))
        {
            $event_description = NULL;
            $errormsg .="<p class = 'error'> Please fill the description</p></span>";
        }
    
        else{
                $event_description = trim($_POST['event_description']);
        }
        
            //check for place to show its error
        if (empty($_POST['place']))
        {
            $place = NULL;
            $errormsg .="<p class = 'error'> Please fill The place you want to go</p></span>";
        }
    
        else{
                $place = trim($_POST['place']);
        }
        
        
                    //checks to see if the catergoy shows the error
        if (empty($_POST['price']))
        {
            $price = NULL;
            $errormsg .="<p class = 'error'> Please fill in the price</p></span>";
            
        }
    
        else{
                $price = trim($_POST['price']);
        }
        
        
    ///////////////////////////////////// Satart Date and Time ////////////////////
// Month
if ($_POST['m'] == "select m" ) {
        $errormsg .="<p class = 'error'> You need select a month </p></span>";
    }
    else {
    $m = $_POST ['m'];
    }
    
// Day
if (($_POST['d'])== "d" ) {
        $errormsg .="<p class = 'error'> You need select a Day </p></span>";
    }
    else {
    $d = $_POST ['d'];
    }
    
// y
if (($_POST['y'])== "y" ) {
    $errormsg .="<p class = 'error'> You need select a year </p></span>";
    
    }
    else {
    $y = $_POST ['y'];
    }
    
// Hour
if (($_POST ['t']=="t")){
        $errormsg .="<p class = 'error'> You need to select the time </p></span>";
    }
    else{
    $t = $_POST ['t'];
    }
    

    
///////////////////////////////////// Satart Date and Time ////////////////////
// Month
if ($_POST['month'] == "select month" ) {
        $errormsg .="<p class = 'error'> You need select a month </p></span>";
    }
    else {
    $month = $_POST ['month'];
    }
    
// Day
if (($_POST['day'])== "day" ) {
        $errormsg .="<p class = 'error'> You need select a Day </p></span>";
    }
    else {
    $day = $_POST ['day'];
    }
    
// y
if (($_POST['year'])== "year" ) {
    $errormsg .="<p class = 'error'> You need select a year </p></span>";
    
    }
    else {
    $year = $_POST ['year'];
    }
    
if (($_POST ['time']=="time")){
        $errormsg .="<p class = 'error'> You need to select the time </p></span>";
    }
    else{
    $time = $_POST ['time'];
    }

    




// Calculations for the days
if ($_POST['month'] == 2 && ($_POST['day']) > 28 ) {
    $errormsg =$errormsg ."This month has only 28 days.<br>";
    }
if ($_POST['month'] == 4 && ($_POST['day']) > 30 ) {
    $errormsg =$errormsg . "This month has only 30 days.<br>";
    }
if ($_POST['month'] == 6 && ($_POST['day']) > 30 ) {
    $errormsg =$errormsg . "This month has only 30 days.<br>";
    }
if ($_POST['month'] == 9 && ($_POST['day']) > 30 ) {
    $errormsg =$errormsg . "This month has only 30 days.<br>";
    }
if ($_POST['month'] == 11 && ($_POST['day']) > 30 ) {
    $errormsg =$errormsg . "This month has only 30 days.<br>";
    }
    
            
                 //checks to see if the email shows the error
        if (empty($_POST['email']))
        {
            $email = NULL;
            $errormsg .="<p class = 'error'> Please fill your email</p></span>";
        }
    
        else{
                $email = trim($_POST['email']);
        }
        
            
    }
    
    
    if ($errormsg!="") {
            echo $errormsg."<br>";
            
            

} // end of errors display
    

}    
?>



<?php

    
        // create the Insert query
                    $dtime= $year."-".$month."-".$day." ".$time;
                $ntime= $y."-".$m."-".$d."-".$t ;
                 $query ="INSERT INTO events(event,event_descrption,place,price,etime,stime,email)";


                $result = @mysql_query ($query);

?>



<form name="form1" enctype="multipart/form-data" id="form1" method="post" action="<?PHP echo $_SERVER['PHP_SELF'];?>">
<table width="20">
  <td width="20"><span class = 'names'> Event: </strong></span> </td>
  <td width="20"><input name="event" type="text" id="event" value="<?php if(isset($_POST['reset'])) echo '';    elseif (isset($_POST['event']))
    echo $_POST['event'];    else echo ''; ?>" size="50" maxlength="45" /> </td>
 </tr>
  <td><p><span class = 'names'>Description:</strong></span> </td>
   <td><input name="event_description" type="text" id="event_description" value="<?php if(isset($_POST['reset'])) echo '';    elseif (isset($_POST['event_description']))
    echo $_POST['event_description'];    else echo ''; ?>" size="50" maxlength="45" /> </td>
 </tr>

   <td><p><span class = 'names'>Place: </strong></span> </td>
    <td><input name="place" type="text" value="<?php if(isset($_POST['reset'])) echo '';    elseif(isset($_POST['place']) ) echo $_POST['place']; ?>" id="place" size="50" maxlength="50" /></td>
    <br />
   </tr>
    <td><span class = 'names'>Price: </strong></span> </td>
     <td><input name="price" type="text" value="<?php if(isset($_POST['reset'])) echo '';    elseif(isset($_POST['price']) ) echo $_POST['price']; ?>" id="price" size="50" maxlength="70" /> </td>
     <br />
         </tr>
         <td><span class = 'names'>Start Time and Date: </strong></span> </td>
         <td><?PHP eventscalendar(); ?> </td>
         <br />
        </tr>
         <td><span class = 'names'>End Time and Date: </strong></span> </td>
         <td><?PHP endtime(); ?> </td>
         <br />
         </tr>
 </p> <td><p><span class = 'names'>Email: </strong></span> </td>
        <td><input name="email" type="text" value="<?php if(isset($_POST['reset'])) echo '';    elseif(isset($_POST['email']) ) echo $_POST['email']; ?>" id="sdate" size="50" maxlength="70" /> </td>
        <br />
              </tr>
       
 </table>
       <!--buttons-->
       <input type="submit" name="Submit" value="Submit">
     
       <input name="reset" type="submit" id="Reset" value="Reset">
     
       <input type="hidden" name="submitted" />
       </p>
       </p>
         </p>
</form>




<div class="footer">
 <?php include ("footer.php") ?>
</div>


------------------------------------------------results page-----------------------




<div class="header">
<?php include ("header2.php") ?>
</div>
<?php


require_once("configproject.php");



// Number of records to show per page:
$display = 8;

// Determine how many pages there are.
if (isset($_GET['np'])) { // Already been determined.

    $num_pages = $_GET['np'];

} else { // Need to determine.

    // Count the number of records
    $query = "SELECT COUNT(*) FROM events";
    $result = mysql_query ($query)or die("first query");
    $row = mysql_fetch_array ($result, MYSQL_NUM);
    $num_records = $row[0];

    // Calculate the number of pages.
    if ($num_records > $display) { // More than 1 page.
        $num_pages = ceil ($num_records/$display);
    } else {
        $num_pages = 1;
    }
    
} // End of np IF.

// Determine where in the database to start returning results.
if (isset($_GET['s'])) {
    $start = $_GET['s'];
} else {
    $start = 0;
}



    
// Make the query.
$query = "SELECT id, event, event_descrption,place, thumbdata,DATE_FORMAT(stime, '%e %d, %Y') AS st, TIME_FORMAT(stime, '%l:%i, %p') AS stime, TIME_FORMAT(etime, '%l:%i, %p')AS etime, email, price FROM events LIMIT $start, $display";

$query2 = "SELECT CONCAT( stime, ' ', etime )
FROM `events";
$result = mysql_query ($query) or die("second query"); // Run the query.
$num = mysql_num_rows($result);
                
            // Display the results
if ($num > 0) {
            
            echo "<p class = 'names'>Currently showing $num Results</p></span>";
    }
    

// Table header.



echo '<table align="center" cellspacing="0" cellpadding="5">
<tr>
<th scope="col" class = "names">Date </span></th>
<th scope="col" class = "names">Time </span></th>
      <th scope="col" class = "names">Event </span></th>
    <th scope="col" class = "names">Descrption </span></th>
  <th scope="col" class = "names">Location </span></th>
    <th scope="col" class = "names">Contact</span></th>
<th scope="col" class = "names">Price</span></th>
  <th scope="col" class = "names">RSVP</span></th>
  

</tr>
';

// Fetch and print all the records.
$bg = '#eeeeee'; // Set the background color.
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
    $bg = ($bg=='#7b1d1d' ? '#ffffff' : '#7b1d1d'); // Switch the background color.
    echo '<tr bgcolor="' . $bg . '">
<td align="left">'.$row['st'].$row['stime'].'</td>
<td align="left">'.$row['et'].$row['etime'].'</td>
<td align="left">'.$row['event'].'</td>
<td align="left" >'.$row['event_descrption'].'</td>
<td align="left">'.$row['place'].'</td>
<td align="left"><a href="mailto?id=' . $row['id'] . '">Contact</a></td>
<td align="left" >'.$row['price'].'</td>
<td align="left"><a href="edit_user.php?id=' . $row['id'] . '">RSVP</a></td>

    </tr>
    ';
}



mysql_free_result ($result); // Free up the resources.    

mysql_close(); // Close the database connection.

// Make the links to other pages, if necessary.
if ($num_pages > 1) {
    
    echo '<br /><p>';
    // Determine what page the script is on.    
    $current_page = ($start/$display) + 1;
    
    // If it's not the first page, make a Previous button.
    if ($current_page != 1) {
        echo '<a href="results2.php?s=' . ($start - $display) . '&np=' . $num_pages . '">Previous</a> ';
    }
    
    // Make all the numbered pages.
    for ($i = 1; $i <= $num_pages; $i++) {
        if ($i != $current_page) {
            echo '<a href="results2.php?s=' . (($display * ($i - 1))) . '&np=' . $num_pages . '">' . $i . '</a> ';
        } else {
            echo $i . ' ';
        }
    }
    
    // If it's not the last page, make a Next button.
    if ($current_page != $num_pages) {
        echo '<a href="results2.php?s=' . ($start + $display) . '&np=' . $num_pages . '">Next</a>';
    }
    
    echo '</p>';
    
} // End of links section.
    

?>
  1. <head><style type="text/css" media="all"> @import "./includes/A4-kreiderCSS.css";</style></head>
  2. <?php include ("header3.php") ?>
  3. </div>
  4. <?PHP
  5. ///////////////////////////////////// Start Dade and Time /////////////////////////////////
  6. function eventscalendar(){
  7. // Monts array
  8. $months = array(1 => 'January', 'February', 'March', 'April', 'May',
  9.   'June', 'July', 'August', 'September', 'October', 'November',
  10.   'December');
  11.         $times = array( '00:00:00'=> 'Midnight', '01:00:00' => '1am', '01:30:00' => '1:30am', '02:00:00' => '2am', '02:30:00' => '2:30am', '03:00:00' => '3am', '04:00:00' => '4am', '04:30:00' => '4:30am', '05:00:00' => '5am','053000' => '5:30am','060000' => '6am', '063000' => '6:30am', '070000' => '7am', '073000' => '7:30am', '080000' => '8am','083000' => '8:30am', '090000' => '9am','09:30:00' => '9:30am', '10:00:00' => '10am','10:30:00' => '10:30am', '11:00:00' => '11am','11:30:00' => '11:30am','12:00:00' => 'Noon', '12:30:00' => '12:30pm', '13:00:00' => '1pm', '13:30:00'=> '1:30pm', '14:00:00' => '2pm','14:30:00' => '2:30pm', '15:00:00' => '3pm','15:30:00' => '3:30pm', '16:00:00' => '4pm','16:30:00' => '4:30pm', '17:00:00' => '5pm','17:30:00' => '5:30pm', '18:00:00' => '6pm','18:30:00' => '6:30pm','19:00:00' => '7pm','19:30:00' => '7:30pm', '20:00:00' => '8pm','20:30:00' => '8:30pm','21:00:00' => '9pm','21:30:00' => '9:30pm', '22:00:00' => '10pm', '22:30:00' => '10:30pm','23:00:00' => '11pm','23:30:00' => '11:30pm');
  12.   // pull doun menu
  13.   echo '<select name="month">';
  14.   echo '<option value="select month">Month</option>\n';
  15.   foreach($months as $key => $value){
  16.    echo "<option value=\"$key\"";
  17.    if($_POST['month'] == $key && !isset($_POST['reset'])){
  18.      echo ' selected="selected"';
  19.    }
  20.    echo ">$value</option>\n";
  21.   }
  22.   echo '</select>';
  23.   echo '<select name="day">';
  24.   echo '<option value="day">Day</option>\n';
  25.   for($day = 1; $day <= 31; $day++){
  26.    echo "<option value=\"$day\"";
  27.    if($_POST['day'] == $day && !isset($_POST['reset'])){
  28.      echo ' selected="selected"';
  29.    }
  30.    echo ">$day</option>\n";
  31.   }
  32.   echo '</select>';
  33.   echo '<select name="year">';
  34.   echo '<option value="year">Year</option>\n';
  35.   $year = 2007;
  36.   while($year <= 2015){
  37.    echo "<option value=\"$year\"";
  38.    if($_POST['year'] == $year && !isset($_POST['reset'])){
  39.      echo ' selected="selected"';
  40.    }
  41.    echo ">$year</option>\n";
  42.    $year++;
  43.   }
  44.   echo '</select>';
  45.  echo '<select name="time">';
  46.   echo '<option value="select t">Time</option>\n';
  47.   foreach($times as $key => $value){
  48.    echo "<option value=\"$key\"";
  49.    if($_POST['time'] == $key && !isset($_POST['reset'])){
  50.      echo ' selected="selected"';
  51.    }
  52.    echo ">$value</option>\n";
  53.   }
  54.   echo '</select>';
  55.     }
  56.     
  57. ?>
  58. <?PHP
  59. ///////////////////////////////////// Start Dade and Time /////////////////////////////////
  60. function endtime(){
  61. // Monts array
  62.     $timevalues = array( '00:00:00'=> 'Midnight', '01:00:00' => '1am', '01:30:00' => '1:30am', '02:00:00' => '2am', '02:30:00' => '2:30am', '03:00:00' => '3am', '04:00:00' => '4am', '04:30:00' => '4:30am', '05:00:00' => '5am','053000' => '5:30am','060000' => '6am', '063000' => '6:30am', '070000' => '7am', '073000' => '7:30am', '080000' => '8am','083000' => '8:30am', '090000' => '9am','09:30:00' => '9:30am', '10:00:00' => '10am','10:30:00' => '10:30am', '11:00:00' => '11am','11:30:00' => '11:30am','12:00:00' => 'Noon', '12:30:00' => '12:30pm', '13:00:00' => '1pm', '13:30:00'=> '1:30pm', '14:00:00' => '2pm','14:30:00' => '2:30pm', '15:00:00' => '3pm','15:30:00' => '3:30pm', '16:00:00' => '4pm','16:30:00' => '4:30pm', '17:00:00' => '5pm','17:30:00' => '5:30pm', '18:00:00' => '6pm','18:30:00' => '6:30pm','19:00:00' => '7pm','19:30:00' => '7:30pm', '20:00:00' => '8pm','20:30:00' => '8:30pm','21:00:00' => '9pm','21:30:00' => '9:30pm', '22:00:00' => '10pm', '22:30:00' => '10:30pm','23:00:00' => '11pm','23:30:00' => '11:30pm');
  63.   
  64.   // pull doun menu
  65.  echo '<select name="t">';
  66.   echo '<option value="t">Time</option>\n';
  67.   foreach($timevalues as $key => $value){
  68.    echo "<option value=\"$key\" ";
  69.    if($_POST['t'] == $key && !isset($_POST['reset'])){
  70.      echo ' selected="selected"';
  71.    }
  72.    echo ">$value</option>\n";
  73.   }
  74.   echo '</select>';
  75.     }
  76. ?>
  77. <?php
  78. require_once("configproject.php");
  79. if (!isset($_POST['reset']))
  80. {
  81.     if (isset($_POST['submitted']))
  82.     {
  83.         $errormsg = "";
  84.         
  85.         
  86.         //check event is blank
  87.         if (empty($_POST['event']))
  88.         {
  89.             $event = NULL;
  90.                         $errormsg .="<p class = 'error'> Please fill in the event</p></span>";
  91.         }
  92.     
  93.         else{
  94.                 $event = trim($_POST['event']);
  95.         }
  96.         
  97.         //Checks the event_description shows error
  98.         
  99.                 if (empty($_POST['event_description']))
  100.         {
  101.             $event_description = NULL;
  102.             $errormsg .="<p class = 'error'> Please fill the description</p></span>";
  103.         }
  104.     
  105.         else{
  106.                 $event_description = trim($_POST['event_description']);
  107.         }
  108.         
  109.             //check for place to show its error
  110.         if (empty($_POST['place']))
  111.         {
  112.             $place = NULL;
  113.             $errormsg .="<p class = 'error'> Please fill The place you want to go</p></span>";
  114.         }
  115.     
  116.         else{
  117.                 $place = trim($_POST['place']);
  118.         }
  119.         
  120.         
  121.                     //checks to see if the catergoy shows the error
  122.         if (empty($_POST['price']))
  123.         {
  124.             $price = NULL;
  125.             $errormsg .="<p class = 'error'> Please fill in the price</p></span>";
  126.             
  127.         }
  128.     
  129.         else{
  130.                 $price = trim($_POST['price']);
  131.         }
  132.         
  133.         
  134.     ///////////////////////////////////// Satart Date and Time ////////////////////
  135. // Month
  136. if ($_POST['m'] == "select m" ) {
  137.         $errormsg .="<p class = 'error'> You need select a month </p></span>";
  138.     }
  139.     else {
  140.     $m = $_POST ['m'];
  141.     }
  142.     
  143. // Day
  144. if (($_POST['d'])== "d" ) {
  145.         $errormsg .="<p class = 'error'> You need select a Day </p></span>";
  146.     }
  147.     else {
  148.     $d = $_POST ['d'];
  149.     }
  150.     
  151. // y
  152. if (($_POST['y'])== "y" ) {
  153.     $errormsg .="<p class = 'error'> You need select a year </p></span>";
  154.     
  155.     }
  156.     else {
  157.     $y = $_POST ['y'];
  158.     }
  159.     
  160. // Hour
  161. if (($_POST ['t']=="t")){
  162.         $errormsg .="<p class = 'error'> You need to select the time </p></span>";
  163.     }
  164.     else{
  165.     $t = $_POST ['t'];
  166.     }
  167.     
  168.     
  169. ///////////////////////////////////// Satart Date and Time ////////////////////
  170. // Month
  171. if ($_POST['month'] == "select month" ) {
  172.         $errormsg .="<p class = 'error'> You need select a month </p></span>";
  173.     }
  174.     else {
  175.     $month = $_POST ['month'];
  176.     }
  177.     
  178. // Day
  179. if (($_POST['day'])== "day" ) {
  180.         $errormsg .="<p class = 'error'> You need select a Day </p></span>";
  181.     }
  182.     else {
  183.     $day = $_POST ['day'];
  184.     }
  185.     
  186. // y
  187. if (($_POST['year'])== "year" ) {
  188.     $errormsg .="<p class = 'error'> You need select a year </p></span>";
  189.     
  190.     }
  191.     else {
  192.     $year = $_POST ['year'];
  193.     }
  194.     
  195. if (($_POST ['time']=="time")){
  196.         $errormsg .="<p class = 'error'> You need to select the time </p></span>";
  197.     }
  198.     else{
  199.     $time = $_POST ['time'];
  200.     }
  201.     
  202. // Calculations for the days
  203. if ($_POST['month'] == 2 && ($_POST['day']) > 28 ) {
  204.     $errormsg =$errormsg ."This month has only 28 days.<br>";
  205.     }
  206. if ($_POST['month'] == 4 && ($_POST['day']) > 30 ) {
  207.     $errormsg =$errormsg . "This month has only 30 days.<br>";
  208.     }
  209. if ($_POST['month'] == 6 && ($_POST['day']) > 30 ) {
  210.     $errormsg =$errormsg . "This month has only 30 days.<br>";
  211.     }
  212. if ($_POST['month'] == 9 && ($_POST['day']) > 30 ) {
  213.     $errormsg =$errormsg . "This month has only 30 days.<br>";
  214.     }
  215. if ($_POST['month'] == 11 && ($_POST['day']) > 30 ) {
  216.     $errormsg =$errormsg . "This month has only 30 days.<br>";
  217.     }
  218.     
  219.             
  220.                  //checks to see if the email shows the error
  221.         if (empty($_POST['email']))
  222.         {
  223.             $email = NULL;
  224.             $errormsg .="<p class = 'error'> Please fill your email</p></span>";
  225.         }
  226.     
  227.         else{
  228.                 $email = trim($_POST['email']);
  229.         }
  230.         
  231.             
  232.     }
  233.     
  234.     
  235.     if ($errormsg!="") {
  236.             echo $errormsg."<br>";
  237.             
  238.             
  239. } // end of errors display
  240.     
  241. }    
  242. ?>
  243. <?php
  244.     
  245.         // create the Insert query
  246.                     $dtime= $year."-".$month."-".$day." ".$time;
  247.                 $ntime= $y."-".$m."-".$d."-".$t ;
  248.                  $query ="INSERT INTO events(event,event_descrption,place,price,etime,stime,email)";
  249.                 $result = @mysql_query ($query);
  250. ?>
  251. <form name="form1" enctype="multipart/form-data" id="form1" method="post" action="<?PHP echo $_SERVER['PHP_SELF'];?>">
  252. <table width="20">
  253.   <td width="20"><span class = 'names'> Event: </strong></span> </td>
  254.   <td width="20"><input name="event" type="text" id="event" value="<?php if(isset($_POST['reset'])) echo '';    elseif (isset($_POST['event']))
  255.     echo $_POST['event'];    else echo ''; ?>" size="50" maxlength="45" /> </td>
  256.  </tr>
  257.   <td><p><span class = 'names'>Description:</strong></span> </td>
  258.    <td><input name="event_description" type="text" id="event_description" value="<?php if(isset($_POST['reset'])) echo '';    elseif (isset($_POST['event_description']))
  259.     echo $_POST['event_description'];    else echo ''; ?>" size="50" maxlength="45" /> </td>
  260.  </tr>
  261.    <td><p><span class = 'names'>Place: </strong></span> </td>
  262.     <td><input name="place" type="text" value="<?php if(isset($_POST['reset'])) echo '';    elseif(isset($_POST['place']) ) echo $_POST['place']; ?>" id="place" size="50" maxlength="50" /></td>
  263.     <br />
  264.    </tr>
  265.     <td><span class = 'names'>Price: </strong></span> </td>
  266.      <td><input name="price" type="text" value="<?php if(isset($_POST['reset'])) echo '';    elseif(isset($_POST['price']) ) echo $_POST['price']; ?>" id="price" size="50" maxlength="70" /> </td>
  267.      <br />
  268.          </tr>
  269.          <td><span class = 'names'>Start Time and Date: </strong></span> </td>
  270.          <td><?PHP eventscalendar(); ?> </td>
  271.          <br />
  272.         </tr>
  273.          <td><span class = 'names'>End Time and Date: </strong></span> </td>
  274.          <td><?PHP endtime(); ?> </td>
  275.          <br />
  276.          </tr>
  277.  </p> <td><p><span class = 'names'>Email: </strong></span> </td>
  278.         <td><input name="email" type="text" value="<?php if(isset($_POST['reset'])) echo '';    elseif(isset($_POST['email']) ) echo $_POST['email']; ?>" id="sdate" size="50" maxlength="70" /> </td>
  279.         <br />
  280.               </tr>
  281.        
  282.  </table>
  283.        <!--buttons-->
  284.        <input type="submit" name="Submit" value="Submit">
  285.      
  286.        <input name="reset" type="submit" id="Reset" value="Reset">
  287.      
  288.        <input type="hidden" name="submitted" />
  289.        </p>
  290.        </p>
  291.          </p>
  292. </form>
  293. <div class="footer">
  294.  <?php include ("footer.php") ?>
  295. </div>
  296. ------------------------------------------------results page-----------------------
  297. <div class="header">
  298. <?php include ("header2.php") ?>
  299. </div>
  300. <?php
  301. require_once("configproject.php");
  302. // Number of records to show per page:
  303. $display = 8;
  304. // Determine how many pages there are.
  305. if (isset($_GET['np'])) { // Already been determined.
  306.     $num_pages = $_GET['np'];
  307. } else { // Need to determine.
  308.     // Count the number of records
  309.     $query = "SELECT COUNT(*) FROM events";
  310.     $result = mysql_query ($query)or die("first query");
  311.     $row = mysql_fetch_array ($result, MYSQL_NUM);
  312.     $num_records = $row[0];
  313.     // Calculate the number of pages.
  314.     if ($num_records > $display) { // More than 1 page.
  315.         $num_pages = ceil ($num_records/$display);
  316.     } else {
  317.         $num_pages = 1;
  318.     }
  319.     
  320. } // End of np IF.
  321. // Determine where in the database to start returning results.
  322. if (isset($_GET['s'])) {
  323.     $start = $_GET['s'];
  324. } else {
  325.     $start = 0;
  326. }
  327.     
  328. // Make the query.
  329. $query = "SELECT id, event, event_descrption,place, thumbdata,DATE_FORMAT(stime, '%e %d, %Y') AS st, TIME_FORMAT(stime, '%l:%i, %p') AS stime, TIME_FORMAT(etime, '%l:%i, %p')AS etime, email, price FROM events LIMIT $start, $display";
  330. $query2 = "SELECT CONCAT( stime, ' ', etime )
  331. FROM `events";
  332. $result = mysql_query ($query) or die("second query"); // Run the query.
  333. $num = mysql_num_rows($result);
  334.                 
  335.             // Display the results
  336. if ($num > 0) {
  337.             
  338.             echo "<p class = 'names'>Currently showing $num Results</p></span>";
  339.     }
  340.     
  341. // Table header.
  342. echo '<table align="center" cellspacing="0" cellpadding="5">
  343. <tr>
  344. <th scope="col" class = "names">Date </span></th>
  345. <th scope="col" class = "names">Time </span></th>
  346.       <th scope="col" class = "names">Event </span></th>
  347.     <th scope="col" class = "names">Descrption </span></th>
  348.   <th scope="col" class = "names">Location </span></th>
  349.     <th scope="col" class = "names">Contact</span></th>
  350. <th scope="col" class = "names">Price</span></th>
  351.   <th scope="col" class = "names">RSVP</span></th>
  352.   
  353. </tr>
  354. ';
  355. // Fetch and print all the records.
  356. $bg = '#eeeeee'; // Set the background color.
  357. while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
  358.     $bg = ($bg=='#7b1d1d' ? '#ffffff' : '#7b1d1d'); // Switch the background color.
  359.     echo '<tr bgcolor="' . $bg . '">
  360. <td align="left">'.$row['st'].$row['stime'].'</td>
  361. <td align="left">'.$row['et'].$row['etime'].'</td>
  362. <td align="left">'.$row['event'].'</td>
  363. <td align="left" >'.$row['event_descrption'].'</td>
  364. <td align="left">'.$row['place'].'</td>
  365. <td align="left"><a href="mailto?id=' . $row['id'] . '">Contact</a></td>
  366. <td align="left" >'.$row['price'].'</td>
  367. <td align="left"><a href="edit_user.php?id=' . $row['id'] . '">RSVP</a></td>
  368.     </tr>
  369.     ';
  370. }
  371. mysql_free_result ($result); // Free up the resources.    
  372. mysql_close(); // Close the database connection.
  373. // Make the links to other pages, if necessary.
  374. if ($num_pages > 1) {
  375.     
  376.     echo '<br /><p>';
  377.     // Determine what page the script is on.    
  378.     $current_page = ($start/$display) + 1;
  379.     
  380.     // If it's not the first page, make a Previous button.
  381.     if ($current_page != 1) {
  382.         echo '<a href="results2.php?s=' . ($start - $display) . '&np=' . $num_pages . '">Previous</a> ';
  383.     }
  384.     
  385.     // Make all the numbered pages.
  386.     for ($i = 1; $i <= $num_pages; $i++) {
  387.         if ($i != $current_page) {
  388.             echo '<a href="results2.php?s=' . (($display * ($i - 1))) . '&np=' . $num_pages . '">' . $i . '</a> ';
  389.         } else {
  390.             echo $i . ' ';
  391.         }
  392.     }
  393.     
  394.     // If it's not the last page, make a Next button.
  395.     if ($current_page != $num_pages) {
  396.         echo '<a href="results2.php?s=' . ($start + $display) . '&np=' . $num_pages . '">Next</a>';
  397.     }
  398.     
  399.     echo '</p>';
  400.     
  401. } // End of links section.
  402.     
  403. ?>
Moderator Remark: Use [code][/code] to encapsulate code snippets
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1585

Post 3+ Months Ago

Have you checked the forms "action" attribute to make sure it is pointing to the script that processes the form data?

Honestly you'd have better luck zipping up all your PHP files as a whole and putting them on a web server somewhere. This code dump is ridiculous.
  • alex89
  • Bronze Member
  • Bronze Member
  • User avatar
  • Posts: 239
  • Loc: Western Australia

Post 3+ Months Ago

In the results page you're trying to find $_GET('np'). None of your form elements are called this, I don't know how you expect this to work.

Add print_r $_GET; to your results page, and you'll see all the information being posted to it.

Since you're using method="post", you should use $_POST('varname'). See here

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 125 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.