close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Simple validation fails

Thread began 4/04/2010 3:41 am by web_assist_mail157665 | Last modified 4/07/2010 2:50 pm by web_assist_mail157665 | 1080 views | 3 replies

web_assist_mail157665

Simple validation fails

ecart checkout
on an include - two folders down

just want to check
address details have been entered
3 fields
add required check - no spaces
redirect fail should return to same page

click checkout (validation on any form press)

no check - order goes on to final place order page, with empty address fields

SB is at top of page (this is the inlcude)

<?php
//WA eCart Include
require_once("../../WA_eCart/eCart1_PHP.php");
?>
<?php require_once('../../Connections/con1.php');?>
<?php require_once("../../WA_ValidationToolkit/WAVT_Scripts_PHP.php"); ?>
<?php require_once("../../WA_ValidationToolkit/WAVT_ValidatedForm_PHP.php"); ?><?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$WAFV_Redirect = "../../index.php?id_sec=54";
$_SESSION['WAVT_checkout_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateRQ(((isset($_POST["street1"]))?$_POST["street1"]:"") . "",true,1);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["city"]))?$_POST["city"]:"") . "",true,2);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["postcode"]))?$_POST["postcode"]:"") . "",true,3);

if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"checkout");
}
}
?>
<?php
$eCart1->GetContent();
?>

<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

mysql_select_db($database_con1, $con1);
$query_rs_region = "SELECT * FROM county_cnty LEFT JOIN country_cntry ON county_cnty.fk_id_cntry_cnty = country_cntry.id_cntry ";
$rs_region = mysql_query($query_rs_region, $con1) or die(mysql_error());
$row_rs_region = mysql_fetch_assoc($rs_region);
$totalRows_rs_region = mysql_num_rows($rs_region);
?>
<?php
if ($eCart1->IsEmpty()) {
$eCart1->redirStr = "index.php?id_sec=7";
$eCart1->cartAction = "RedirectIfEmpty";
}
?>
<?php
// WA eCart Redirect
if ($eCart1->redirStr != "") {
header("Location: ".$eCart1->redirStr);
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<link href="../../WA_eCart/CSS/eC_Checkpoint_Slate_Arial.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div class="articleFree">
<div class="article">
<h4>Booking Stages: </h4>
<p class="eC_small_text">Select Pitch &gt; Enter Pitch Details&gt;Buy Pitch Options<br />
<strong>Confirm Billing Info</strong>&gt;Confirm Costs & Place Booking</p>
<p class="eC_small_text">&nbsp;</p>
<div class="eC_Checkpoint_Slate_Arial">
<h2>Confirm Billing Information</h2>
<div class="eC_CheckoutFormWrapper">
<form name="ecart_checkout_form" action="../../index.php?id_sec=55" method="post">
<div class="eC_PurchaserInfoWrapper">
<div class="eC_CheckoutFormBody">
<div class="eC_FieldsetWrapper">
<table cellpadding="0" border="0" class="eC_HeadingTable"><tr><td><h2>Billing Information</h2></td><td class="eC_bottomLine"><div>&nbsp;</div></td></tr></table>
<table border="0" cellpadding="0" cellspacing="0">

<tr>
<th><label for="firstname" >First name</label></th>
<td>&nbsp;</td>
<td><input name="firstname" type="text" id="firstname" value="<?php echo $_SESSION['kt_firstname_usr']; ?>" size="32" /></td>
</tr>


<tr>
<th><label for="lastname" >Last name</label></th>
<td>&nbsp;</td>
<td><input name="lastname" type="text" id="lastname" value="<?php echo $_SESSION['kt_surname_usr']; ?>" size="32" /></td>
</tr>


<tr>
<th><label for="email" >Email address</label></th>
<td>&nbsp;</td>
<td><input name="email" type="text" id="email" value="<?php echo $_SESSION['kt_email_usr']; ?>" size="32" /></td>
</tr>


<tr>
<th><label for="phone" >Phone number</label></th>
<td>&nbsp;</td>
<td><input name="phone" type="text" id="phone" value="" size="32" /></td>
</tr>


<tr>
<th><label for="fax" >Fax number</label></th>
<td>&nbsp;</td>
<td><input name="fax" type="text" id="fax" value="" size="32" /></td>
</tr>


<tr>
<th><label for="street1" >Address</label></th>
<td>&nbsp;</td>
<td><input name="street1" type="text" id="street1" value="<?php echo $_SESSION['kt_address1_usr']; ?>" size="32" /></td>
</tr>


<tr>
<th><label for="street2" >Address line 2</label></th>
<td>&nbsp;</td>
<td><input name="street2" type="text" id="street2" value="" size="32" /></td>
</tr>


<tr>
<th><label for="city" >City/Town</label></th>
<td>&nbsp;</td>
<td><input name="city" type="text" id="city" value="<?php echo $_SESSION['kt_city_usr']; ?>" size="32" /></td>
</tr>


<tr>
<th><label for="state_province" >Region</label></th>
<td>&nbsp;</td>
<td><select name="state_province" id="state_province" >
<option value="" <?php if (!(strcmp("", $_SESSION['kt_county_usr']))) {echo "selected=\"selected\"";} ?>>Select region</option>
<?php
do {
?>
<option value="<?php echo $row_rs_region['name_cnty']?>"<?php if (!(strcmp($row_rs_region['name_cnty'], $_SESSION['kt_county_usr']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rs_region['name_cnty']?></option>
<?php
} while ($row_rs_region = mysql_fetch_assoc($rs_region));
$rows = mysql_num_rows($rs_region);
if($rows > 0) {
mysql_data_seek($rs_region, 0);
$row_rs_region = mysql_fetch_assoc($rs_region);
}
?>
</select></td>
</tr>


<tr>
<th><label for="postcode" >Postal Code</label></th>
<td>&nbsp;</td>
<td><input name="postcode" type="text" id="postcode" value="<?php echo $_SESSION['kt_postcode_usr']; ?>" size="12" /></td>
</tr>
</table>
</div>
</div>
</div>
<table class="eC_ButtonWrapper" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<input type="submit" name="Checkout" id="Checkout" value="Continue" class="eC_FormButton" />
</td>
</tr>
</table>
</form>
</div>
</div>

</div>
</div>

</body>
</html>
<?php
mysql_free_result($rs_region);
?>

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