close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Server Validations losing $_POST values and

Thread began 12/06/2019 4:24 pm by Steve | Last modified 12/09/2019 2:15 pm by Steve | 124 views | 23 replies

Steve

Ray,
As always thank you for your help (especially on a Sunday).

My page does two things:
1) allows checking a price based on selections
2) processes the order and validates the presence of Credit Card credentials.

This is achieved via two buttons.
1) $_POST["calc-cost"] is used for calculating the costs which are displayed on page
2) $_POST["submit"] does the final submit

How do Server Validations handle this case? I can add another set of validations that have duplicates of the calc-cost fields. Then double up ( using OR / || ) the conditional Validation Show Ifs. Would that be the best way?

Example:

<?php 
if (isset($_POST["calc-cost"]) || isset($_POST["calc-cost_x"])) {
$WAFV_Redirect = "rates-and-availabilityy?fail=true";
$_SESSION['WAVT_ratesandavailabilityx_815_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateRQ(((isset($_POST["contactName"])) ? $_POST["contactName"] : "") . "",false,1);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["email"])) ? $_POST["email"] : "") . "", true,2);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["dateArrive"])) ? $_POST["dateArrive"] : "") . "", false,3);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["dateDepart"])) ? $_POST["dateDepart"] : "") . "", false,4);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["personsQty"])) ? $_POST["personsQty"] : "") . "", false,5);

if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"ratesandavailabilityx_815");
}
}
?>
<?php
if (isset($_POST["submit"]) || isset($_POST["submit_x"])) {
$WAFV_Redirect = "rates-and-availabilityy?fail=true";
$_SESSION['WAVT_ratesandavailabilityy_959_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateRQ(((isset($_POST["contactName"])) ? $_POST["contactName"] : "") . "",false,1);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["email"])) ? $_POST["email"] : "") . "", true,2);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["dateArrive"])) ? $_POST["dateArrive"] : "") . "", false,3);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["dateDepart"])) ? $_POST["dateDepart"] : "") . "", false,4);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["personsQty"])) ? $_POST["personsQty"] : "") . "", false,5);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["txtCC"]))?$_POST["txtCC"]:"") . "",false,6);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["selCCMonth"]))?$_POST["selCCMonth"]:"") . "",false,7);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["selCCYear"]))?$_POST["selCCYear"]:"") . "",false,8);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["textcvv"]))?$_POST["textcvv"]:"") . "",false,9);

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



Then I would need to double up the conditional on my inputs as I add a class "invalid" IF the Server Side Validation fails.

Example (not checking both 815 and 959 yet):

<input name="contactName" type="text" class="form-control order-1 <?php
if (ValidatedField('ratesandavailabilityx_815','ratesandavailabilityx_815')) {
if ((strpos((",".ValidatedField("ratesandavailabilityx_815","ratesandavailabilityx_815").","), "," . "1" . ",") !== false || "1" == "")) {
if (!(false)) {
?>invalid<?php }}} ?>"
value="<?php if(isset($_SESSION['contactName'])) { echo $_SESSION['contactName'] ; } ?>" >



Just want to make sure I am heading in the correct logical direction..?

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...