I am using this script
<?php
$today = getdate();
$day = $today['weekday'];
$week = "2"
?>
to set two strings to the day and week when someone logs onto a page.
but also on that page I have a form where the person can go to previous or future day's pages (by passing variables to the address bar). The variable in the address bar determine what fields from the database are selected.
when they select the dates, click submit the form sends the variables to the address bar, but when the page is processed, script above cancels out their input.
what i need is a way to check if there are any variable in the address bar, if not then run the script if so, skip it.
Here's the page:
<html>
<body>
<table>
<tr><td valign="top"><img src="devohead.gif"><br>
<form action="devo2.php" method="GET" name="myform">
<select name="week" cols=40>
<option value="1">ID in Christ
<option value="2">That lonely feeling
<option value="3">Lust
<option value="4">Forgiveness
<option value="5">Honor
<option value="6">love
<option value="7">Joy
<option value="8">Peace
<option value="9">Patience
<option value="10"Goodness
<option value="11">Kindness
<option value="12">Faithfulness
<option value="12">Gentleness
<option value="12">Self-Control
</select>
<br>
<select name="day">
<option value="monday">Monday
<option value="tuesday">Tuesday
<option value="wednesday">Wednesday
<option value="thursday">Thursday
<option value="friday">Friday
</select>
<br>
<input type="Submit" value="Take A Look" align="MIDDLE">
</form>
<form method="POST" action="javascript:window.print()">
</td><td width="400"><font face="arial">
<?php
$db = mysql_connect("localhost", "church_devo");
mysql_select_db("church_crave",$db);
$test = "Verse";
$verse = $day;
$verse .= $test;
$test2 = "Questions";
$question = $day;
$question .= $test2;
$result = mysql_query("SELECT * FROM devo WHERE index = $week",$db);
if ($myrow = mysql_fetch_array($result)) {
do {
printf("<font size=+1>%s - $day</font><hr>%s<br>Objective: %s<hr><br></face>\n", $myrow["title"], $myrow["topic"], $myrow["objective"]);
$str = $myrow[$verse];
printf(" %s<br><br> %s<br> %s<br></face>\n", $myrow[$verse], $myrow[$question], "<TEXTAREA ROWS=5 COLS=48></TEXTAREA>");
} while ($myrow = mysql_fetch_array($result));
} else {
echo "Sorry, no records were found!";
}
// preg_split ( string pattern, string subject [, int limit [, int flags]])
//printf("%s", $myrow[$verse]);
//$chars = preg_split('/,/', $str, -1);
//print_r($chars);
?>
</face>
</td></tr></table>
<input type="submit" value="Print This Page with Your Responses" name="print"><input type="reset" value="Clear Your Responses" name="clear">
</form>
</body>
</html>