Forum Moderators: coopster
It checks for
Empty fields
if it is then error
checks for numbers when it should be strings and vice versa
however i do not know how to do it so if the user enters numbers and strings i.e ghf65 then it produces an error.
//If User has entered characters instead of nuumbers and then will cause an error
if(ereg("^[a-zA-Z]$*", $_POST['option'])) echo 'needs to be numba';
//If User has entered nothing, then it will cause an error
else if (empty($_POST['option']))
ps
if you think coding is inconsistent please advise me, i would welcome and suggestions
also how do i do it so if the user presses the back button, the previous version of the database is not seen. i.e. the rows before delete
Cheers
<?php
$listCurrentRecords=true;
if (isset($_POST['s'])) {
$listCurrentRecords=false;
$matchingRecords=true;
}
if($listCurrentRecords) {
echo ( '<form action="shoppingDatabaseDelete.php" method="post">' );
//Connection to Database
$dbcon=pg_pconnect("host=dbh port= dbname=uc user=c password=ect");
//SQL statement looking for information in the database
$sql="SELECT * FROM shop";
//Prints the SQL statement
echo $sql;
//Stores the result of the SQL statement
$result = pg_exec($sql);
//Returns the number of rows in the result
$nrows = pg_numrows($result);
<display results here>
What is the second question? If a user presses the back button in the browser, how can I show them what was on the page prior to it being processed?
What happens is the 1st time the user vists the page, the user enters id number, and a row from the table is deleted showing the latest results (i.e table -1 rows)
i want it so that if the user presses back after above operation it does not show the old version of the table.
is this possible?
You could use no-cache headers to force the browser to reload the page and then test for the existance of the submitted id you mentioned. If the id is not there then refresh the page to some other option.
You could disable the back button with javascript too.
That's all I can really think of.