The reason I need to auto-submit the form on its first load is that the form is purely for loading a timetable, the form is labelled weeks and is where logged in users may enter the week in which they wish to view the timetable,
<p>Please enter the week number you wish to see the lesson availability for.. (1, 2, 3 etc.)<p><br>
<form action="" method="post" name="weeks">
<font: Arial size: 12>
Week: <input type="text" name="week" value="0"/><br>
<input type="submit" name="Update" /><br>
</form>
The default is null, but 0 would also suffice.
I need to have this submitted onload else the user will initially view a timetable where every row and column will show an error message. As no variables would have been called.
The current method I am attempting involves session counting, but I cannot work out the correct function that doesn't run infinitely.
THis is the standard session counting method I am using
<?php
session_start();
if(isset($_SESSION['views']))
$_SESSION['views'] = $_SESSION['views']+ 1;
else
$_SESSION['views'] = 1;
echo "views = ". $_SESSION['views'];
...
?>
And here's the code for the function, which initializes, but never stops!
<script type ="text/javascript">
<head>
...
<!--
function submit() {
var i='$_SESSION[views]';
while (i=='$_SESSION[views]')
{
document.weeks.submit();
i=0;
}
}
-->
</script>
</head>
<body onLoad="submit()">
Thank you for your patience and interest!
Spud 🙂