Tener un problema...
- kej0283
- Novice


- Registrado: Sep 30, 2009
- Mensajes: 18
- Status: Offline
Tengo el siguiente formulario: Heres el código: Mi problema es que cuando entro a la información en la forma: su no ir a mi página de resultados: Abajo está el código de los resultados .. Errores Im no ponerse en forma. ¿Puede alguien ayudarme por favor?? Gracias!
Código: [ 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.
?>
<?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.
?>
- <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.
- ?>
Moderator Remark: Use [code][/code] to encapsulate code snippets
- Anonymous
- Bot


- Registrado: 25 Feb 2008
- Mensajes: ?
- Loc: Ozzuland
- Status: Online
Octubre 3rd, 2009, 10:34 am
- PolishHurricane
- Mastermind


- Registrado: Feb 17, 2005
- Mensajes: 1585
- Status: Offline
¿Ha revisado las formas de "acción" atributo para asegurarse de que está apuntando al script que procesa los datos del formulario?
Honestamente youd tener mejor suerte comprimir todos los archivos de su PHP como un todo y ponerlos en un servidor web en alguna parte. Este basurero código es ridículo.
Honestamente youd tener mejor suerte comprimir todos los archivos de su PHP como un todo y ponerlos en un servidor web en alguna parte. Este basurero código es ridículo.
There's no place like 127.0.0.1, badass part is now it's ::1
- alex89
- Bronze Member


- Registrado: Jul 18, 2008
- Mensajes: 239
- Loc: Western Australia
- Status: Offline
En la página de resultados que están tratando de encontrar $ _GET ( "NP"). Ninguno de los elementos de su formulario se denominan esto, no sé cómo se espera que esto funcione.
Añadir print_r $ _GET; a la página de resultados, y podrás ver toda la información que se envió a ella.
Puesto que usted está utilizando method = "post", usted debe utilizar $ _POST ( "varname"). Ver aquí
Añadir print_r $ _GET; a la página de resultados, y podrás ver toda la información que se envió a ella.
Puesto que usted está utilizando method = "post", usted debe utilizar $ _POST ( "varname"). Ver aquí
Página 1 de 1
Para responder a este tema que necesita para ingresar o registrarse. Es gratis.
Publicar Información
- Total de mensajes en este tema: 3 mensajes
- Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 274 invitados
- No puede abrir nuevos temas en este Foro
- No puede responder a temas en este Foro
- No puede editar sus mensajes en este Foro
- No puede borrar sus mensajes en este Foro
- No puede enviar adjuntos en este Foro
