View Full Version : Increasing a number by 1 on page load.

03-10-2005, 05:17 AM
I'm not that advanced with my Java, so I need some assistance.

I'm creating an online form for problem reporting and I need to have a new job number (increases by one) everytime an employee loads the site.

It's not as easy as creating a hit counter, as I need it to appear in a textarea so that the number is posted with the rest of the information.

If anyone can assist, this would be excellent. I've included my current code below so you can see what direction I'm heading. If you have any other suggestions, let me know!

Thanks, Weez

<title>IT Problem Report Form</title>



<table width="1023" border="0" cellspacing="0" cellpadding="0">
<td width="205" height="1063"></td>
<td width="663"><form action="mailto: ..." method="post" enctype="text/plain" name="ProblemReport" id="ProblemReport">


<pre><p><font face = "arial" size = "6"><b><i>IT Problem Reporting Form</b></i></font><font face = "arial">

Date (dd/mm): <input name="Date " type="text" id="Date" value="" size="5" maxlength="5"><br>
First Name: <input name="FName " type="text" id="FName" size="20" maxlength="20"><br>
Surname: <input name="SName " type="text" id="SName" size="20" maxlength="20"><br>
Username: <input name="UName " type="text" id="UName" size="20" maxlength="20"><br>
School: <select name="Campus " id="Campus"><option value=" S">Senior</option><option value=" M">Middle</option><option value=" J">Junior</option><option value=" B">Bellarine</option><br><br>


Computer location (if applicable): <input name="Location " type="text" id="Location" size="59" maxlength="50"><br>
Have you attempted resetting your computer? <label><input type="radio" name="Reset " value=" Y">Yes</label> <label><input type="radio" name="Reset" value=" N">No</label><br>
Have you checked cables to see if connected properly? <label><input type="radio" name="Cables " value=" Y">Yes</label> <label><input type="radio" name="Cables" value=" N">No</label>

Problem description
<textarea name="Problem " cols="80" rows="5" id="Problem"></textarea><br>
Error message description
<textarea name="Errors " cols="80" rows="2" id="Errors"></textarea><br>
When did you discover the problem?
<textarea name="Discovered " cols="80" rows="5" id="Discovered"></textarea><br>
Steps attempted to fix problem
<textarea name="Attempted " cols="80" rows="5" id="Attempted"></textarea><br>
To assist us with prioritising, how urgent is this problem?<br>
<input type="radio" name="Urgency " value=" 1">Extremely
<input type="radio" name="Urgency " value=" 2">Fairly
<input type="radio" name="Urgency " value=" 3">When You Have Time<br>


<br><input type="submit" name="Submit " value="Submit"> <input name="Reset" type="reset" id="Reset" value="Reset"><br>
Thankyou for taking the time to complete this form.
We will assess your problem as soon as possible.</p>
- IT Department -


<!---FORM END---!>

<td width="155"></td>

<!---TABLE END---!>


Philip M
03-10-2005, 08:22 AM
First of all, this forum is about JavaScript, not Java, which is a completely different language in spite of the confusingly similar name.

Secondly, JavaScript has no capability to read from or write to a file,
so you will need a server-side language such as PHP or PERL to keep track
of the job number and increment it by one each time.

It is possible to create a unique (but not sequential) job number based on the time of day, at its crudest something like 1155231003, i.e submitted at 11.55.23 on 10th March.