titch35
11-15-2007, 06:20 PM
sorry i am new to this, but still learning:
if someone want to book a seat for a property course, they have to enter a seat no into a html form, but i am looking for a solution using PHP or JAVASCRIPT so that once they enter a seat no and a name, the array will then display a x to state that that seat has ben booked already, is there a way round this?? can i overwrite it?
this is my text file:
|1 |11|21|31|41|51|71|81
|2 |12|22|32|42|52|72|82
|3 |13|23|33|43|53|73|83
|4 |14|24|34|44|54|74|84
|5 |15|25|35|45|55|75|85
|6 |16|26|36|46|56|76|86
|7 |17|27|37|47|57|77|87
|8 |18|28|38|48|58|78|88
|9 |19|29|39|49|59|79|89
|10|20|30|40|50|60|80|90
his is the PHP using to read the text file.
<center>
<table summary="List of demo fields">
<tr>
<th>Row 1</th>
<th>Row 2</th>
<th>Row 3</th>
<th>Row 4</th>
<th>Row 5</th>
<th>Row 6</th>
<th>Row 7</th>
<th>Row 8</th>
</tr>
<?php
$file = fopen('seats.txt','r');
if (!$file) {echo 'ERROR: Unable to open file.</table></body></html>'; exit;}
while (!feof($file)) {
$line = fgets($file);
list ($field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8) = split ('\|', $line);
echo '
<tr>
<td>'.$field1.'</td>
<td>'.$field2.'</td>
<td>'.$field3.'</td>
<td>'.$field4.'</td>
<td>'.$field5.'</td>
<td>'.$field6.'</td>
<td>'.$field7.'</td>
<td>'.$field8.'</td>
</tr>';
$file++;
}
fclose($file);
echo '
</table>
<p><small>12 October 2004 · Last updated: '.date('j F Y', getlastmod()); ?>
<br/>
<br/>
<center>
<h2> Please enter your Name, Seat No & Phone Number</h2>
<form action="upload.php" method="get">
First Name: <input type="text" name="CustFname" size="20" /><br/><br/>
last Name: <input type="text" name="CustLname" size="20" /><br/><br/>
Mobile No: <input type="text" name="MobileNo" size="20" /><br/><br/>
Seat No: <input type="text" name="SeatNo" size="20" /><br/><br/>
<input type="submit" value="Submit" name="Submit" /><br/><br/>
</form>
</center>
if someone want to book a seat for a property course, they have to enter a seat no into a html form, but i am looking for a solution using PHP or JAVASCRIPT so that once they enter a seat no and a name, the array will then display a x to state that that seat has ben booked already, is there a way round this?? can i overwrite it?
this is my text file:
|1 |11|21|31|41|51|71|81
|2 |12|22|32|42|52|72|82
|3 |13|23|33|43|53|73|83
|4 |14|24|34|44|54|74|84
|5 |15|25|35|45|55|75|85
|6 |16|26|36|46|56|76|86
|7 |17|27|37|47|57|77|87
|8 |18|28|38|48|58|78|88
|9 |19|29|39|49|59|79|89
|10|20|30|40|50|60|80|90
his is the PHP using to read the text file.
<center>
<table summary="List of demo fields">
<tr>
<th>Row 1</th>
<th>Row 2</th>
<th>Row 3</th>
<th>Row 4</th>
<th>Row 5</th>
<th>Row 6</th>
<th>Row 7</th>
<th>Row 8</th>
</tr>
<?php
$file = fopen('seats.txt','r');
if (!$file) {echo 'ERROR: Unable to open file.</table></body></html>'; exit;}
while (!feof($file)) {
$line = fgets($file);
list ($field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8) = split ('\|', $line);
echo '
<tr>
<td>'.$field1.'</td>
<td>'.$field2.'</td>
<td>'.$field3.'</td>
<td>'.$field4.'</td>
<td>'.$field5.'</td>
<td>'.$field6.'</td>
<td>'.$field7.'</td>
<td>'.$field8.'</td>
</tr>';
$file++;
}
fclose($file);
echo '
</table>
<p><small>12 October 2004 · Last updated: '.date('j F Y', getlastmod()); ?>
<br/>
<br/>
<center>
<h2> Please enter your Name, Seat No & Phone Number</h2>
<form action="upload.php" method="get">
First Name: <input type="text" name="CustFname" size="20" /><br/><br/>
last Name: <input type="text" name="CustLname" size="20" /><br/><br/>
Mobile No: <input type="text" name="MobileNo" size="20" /><br/><br/>
Seat No: <input type="text" name="SeatNo" size="20" /><br/><br/>
<input type="submit" value="Submit" name="Submit" /><br/><br/>
</form>
</center>