i guess i didn't really have to make this page load repeatedly like this (but, why should it matter, right? i mean.. technically, couldn't i get it to reload indefinietly?) but, i didn't want the user to be sent all over to different pages just to fill out this little scheduing form thing.

i see already from the PHP code coloring that i've got something seriously wrong right around my midsection

i've spent so much time on this alone already, i could really use a fresh pair of eyes. i realize i probably should have tried to debug that section... but... what can ya do.. thanks for reading!

<?php
ob_start();
session_start();
                            // START. IF FLOW IS EMPTY SCRIPT HALTS. schedule.php IS DISPLAYED 
if (empty($_POST['flow'])) {

if (isset($_SESSION['flow'] && $_SESSION['flow'] = "go")) {

        if (isset($_POST['op']) && ($_POST['op'] == "makedate")) {
                                        // make the timestamp
            $day = $_POST['day']; 
            $month = $_POST['month'] + 1;
            $m = $month;
            $year = $_POST['year']; 
            $year = $year + 2005;
            $mkhour = $_POST['hour'];
            $mkmin = $_POST['min'];
            
            $check = checkdate($m, $day, $year);
            if ($check == 1) {
            
            $newtime = date("M-d-Y \a\\t h:i a", mktime($mkhour, $mkmin, 0, $month, $day, $year));
            $tstime = mktime($mkhour, $mkmin, 0, $month, $day, $year);
            $dynadate = "<p>READY TO MAKE THE DATABASE QUERY and move on!!!</p>";
            $ready = 1;
        
        } elseif ($check == 0) {        
        $ready = 0;
        $dynadate = "<p>You entered an invalid date! Please <a href=\"schedule.php\">try again</a>:</p>";
        
}
    
}

header("Location: url("schedule.php"));
    exit;
}
else {     // CHECK FOR ['OP'] WHICH IS SET AFTER TIME IS SELECTED
}
    
    
} else     if (isset($_POST['flow']) && ($_POST['flow'] == "go")) { 

    $dynadate = "";
    $_SESSION['flow'] = $_POST['flow'];
    
 if (isset($newtime, $_POST['op'], $day, $m, $month, $year, $_POST['day'])) {
} else {    // THE IF ISSET W/ OUT FLOW SWITCHING IS USED TO SET THE VARIABLES FOR DYNADATE PULL-DOWNS ? can see no other purpose
} 
        
// BEGIN MAKING HTML FORM
$dynadate .= "<h3>Select the Date for your Big Day!</h3>
                <p class=\"specialmsg\"><strong>STOP!</strong> Before entering this date... Thanks for your cooperation!</p>
    <form method=\"post\" action=\"$_SERVER[PHP_SELF]\">";



// MAKE MONTHS ARRAY
global $m;    
 $monthArray = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 
 'September', 'October', 'November', 'December');
$dynadate .= "<select name=\"month\">";
for ($m = 0; $m < count($monthArray)+1; $m++){
$dynadate .= "<option value=\"$m\">$monthArray[$m]</option>";
if ($m == 11) {
    break;
} else {
    
}
}
    $dynadate .= "</select>";

// MAKE DAYS ARRAY    
$dynadate .= "<select name=\"day\">";
for ($x = 0; $days = $x+1; $x++){
    
$dynadate .= "<option value=\"$days\">$days</option>";
if ($x==30) {
    break;
}
}
$dynadate .= "</select>";

// MAKE YEARS ARRAY    
$yearArray = array('2005', '2006', '2007', '2008', '2009', '2010');
$dynadate .= "<select name=\"year\">";
for ($y = 0; $y < count($yearArray)+1; $y++){
$dynadate .= "<option value=\"$y\">".$yearArray[$y]."</option>";
if ($y == 5) {
    break;
} else {
$yearnum = $y;    
}
}


$dynadate .= "</select>";

// BEGIN TIME SECTION
$dynadate .= "<p class=\"specialmsg\">What time ... that day.</p>";
$hours = 24;
$min_sec = 60;

$hour = '<select name="hour">';
for($i=0; $i<=$hours; $i++){
    $hour .= '<option value="'.$i.'">'.date('h (a)', mktime($i,0,0,1,1,2000)).'</option>';
}
$hour .= '</select>';

$min = '<select name="min">';
for($i=0; $i<=$min_sec; $i++){
    $min .= '<option value="'.$i.'">'.date('i', mktime(0,$i,0,1,1,2000)).'</option>';
}
$min .= '</select>';

$dynadate .= "$hour.$min";

// $_POST['op'] = makedate
$dynadate .= "<input type=\"hidden\" name=\"op\" value=\"makedate\"/>
    <br /><input type=\"submit\" name=\"submit\" value=\"Enter Date\" /></form>"; 


} // END THE QUITE LENGTHY DATE-DROP-DOWN FORM THING
 else {
header("Location: url("schedule.php"));
exit;    
} echo $dynadate;   {
}


    

?>
<html>stuff</html>            
<?php 

    if    empty($ready)      {
            
        echo $dynadate;    
    }

?>

by the way-- sorry to be that guy who comes in and posts a crack-load of code, lookin for answers the cheap and easy way. i welcome anyone w/ beginner to moderately complex inquiries to PM me if you need to get un-stuck from somwhere. as you can see from this code, i ain't that good, but i do know what a lot of it is supposed to do. heehee

EDIT: if this seems a little schizophrenic, it's because i chopped the date dropdown stuff right out of something i did about a year ago... there's one part in there, i was like... 'huh?'-- where the if isset(...) doesn't really do anything... i left it there cause i was being lazy-- thinking it was some BandAid i put over some other part which was poorly structured. the whole date thing is heavily influenced by helpers in another great forum.

i see what's wrong w/ that middle part-- one too many else's in that if else expression! :O
probably because i was originally pulling the date part in via include (notice the html break near the bottom)... yes-- a schizo hodgepodge of messed up. this things got more cut and paste than a 2nd grade art class! ;)

lemme check to see if that fixes it...
(*crosses fingers*)

hey there-- i hope no one has bothered w/ this... i realized my errors

suddenly it occurred to me that i was getting a white screen every time, instead of the NOTICE and WARNING messages... here, something i installed must have modified my php.ini and i just realized it!
what a headache-- it's so much easier when you know which lines are messing up!!
doh!

This article has been dead for over six months. Start a new discussion instead.