Forum Moderators: coopster

Message Too Old, No Replies

Refreshing Page

Refreshing Page

         

Imy_S3

9:43 pm on Mar 9, 2004 (gmt 0)

10+ Year Member



Hi
Have the code below

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>

coopster

2:13 pm on Mar 10, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I believe the first part of your question regarding finding numeric or text values, but not both, may be addressed in the other thread you started, Error Checking in PHP [webmasterworld.com].

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?

Imy_S3

4:22 pm on Mar 10, 2004 (gmt 0)

10+ Year Member



No it is not.

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?

jatar_k

4:32 pm on Mar 10, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



for the most part the browser is showing a cached version of the page so you may not be able to defeat this reliably.

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.

Imy_S3

5:03 pm on Mar 10, 2004 (gmt 0)

10+ Year Member



how do u disable back button using java script

jatar_k

5:25 pm on Mar 10, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



disable back button of browser [webmasterworld.com]