close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Repeating querystring on fail

Thread began 2/21/2012 4:12 pm by Ian S | Last modified 2/22/2012 8:10 am by Jason Byrnes | 1598 views | 3 replies |

Ian S

Repeating querystring on fail

Hi

Using server validations, if the validation fails I pass the fail=1 query string value.

If the form fails twice, this value gets passed twice. Three failures equals three instances of the query string value.

i.e
additem.php?fail=1&fail=1&fail=1&fail=1&fail=1&fail=1&fail=1&fail=1&fail=1&fail=1&fail=1&fail=1&fail=1

The validation code is

<?php 
if (isset($_POST["BT_Submit"])) {
$WAFV_Redirect = "additem.php?fail=1";
$_SESSION['WAVT_additem_059_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateRQ(((isset($_POST["name"]))?$_POST["name"]:"") . "",true,1);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["stockcode"]))?$_POST["stockcode"]:"") . "",true,2);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["description"]))?$_POST["description"]:"") . "",true,3);

if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"additem_059");
}
}
?>



Can I stop this from happening and just pass the on fail value?

Cheers
Ian

Sign in to reply to this post

Jason ByrnesWebAssist

add the following code at line 1 of the apge:

php:
<?php 

function cleanQS() {
    
$varQS ""
    if(isset(
$_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "") {
        
$arrRemove = array();
        
$arrRemove[] = "fail";
        
$arrQS explode("&"$_SERVER["QUERY_STRING"]);
        foreach(
$arrQS as $k => $v) {
            
$arrVar explode("="$v);
            if(
in_array($arrVar[0], $arrRemove)) unset($arrQS[$k]);
        }
        if(
sizeof($arrQS) > 0) {
            
$varQS "".implode("&"$arrQS);
        } 
    }
    return 
$varQS;
}

if(isset(
$_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != ""$_SERVER["QUERY_STRING"] = cleanQS($_SERVER["QUERY_STRING"]);
?>
Sign in to reply to this post

Ian S

Top man. Thank you Jason

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...