<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "Error code validation not validating correctly"]]></title>
		<link>https://proxy2.de/forum/posts/list/3.php</link>
		<description><![CDATA[Latest messages posted in the topic "Error code validation not validating correctly"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>Error code validation not validating correctly</title>
				<description><![CDATA[ I have an Error code for validating my form. It is a conditional validation.<br /> <br /> If the there is an item offered<br /> = or &lt; then the error message is displayed. Otherwise it records the record. b_offer is the entered value by the user and the boffer is the value retreived from the database. <br /> <br /> When form is submitted b_offer is replaces the value in the boffer in the database based on the error validation below.<br /> <br /> Hope some one could help me with the correct code <br /> <br /> Thanks<br /> <br /> Here is the code<br /> [php]<br /> // Error code starts here<br /> $Error = "0";  /* set error flag to 0*/<br /> $ErrorMsg = array();    /*create a new array to hold error messages*/<br /> <br /> if($HTTP_POST_VARS['b_Offer'] &gt; $HTTP_POST_VARS['bOffer']){   /* is the new offer greater than the current offer*/<br /> $Error = "1";    /* is the new offer greater than the current offer*/<br /> $ErrorMsg[0] = "Enter a value greater than Last Offer";  /* is the new offer greater than the current offer*/<br /> }<br /> if (!$HTTP_POST_VARS['bOffer']){  /* if offer is blank in the form, set flag to 1 and add message to the array */<br /> $Error = "1";<br /> $ErrorMsg[1] = "You must enter an Offer";<br /> }<br /> if (!$HTTP_POST_VARS['bName']){   /* if Name is blank set error and add message */<br /> $Error = "1";<br /> $ErrorMsg[2] = "You must enter your Name";<br /> }<br /> if (!$HTTP_POST_VARS['bSurName']){  /* if SurName is blank set error and add message */<br /> $Error = "1";<br /> $ErrorMsg[3] = "You must enter your SurName/Last name";<br /> }<br /> if (!$HTTP_POST_VARS['bEmail'] || !validate_email($HTTP_POST_VARS['bEmail'])){  /* if email address is blank or not a valid email address, set error and add message */<br /> $Error = "1";<br /> $ErrorMsg[4] = "You must enter a valid Email address";<br /> }<br /> if($HTTP_POST_VARS['b_Offer'] = $HTTP_POST_VARS['bOffer']){   /* is the new offer greater than the current offer*/<br /> $Error = "1";    /* is the new offer greater than the current offer*/<br /> $ErrorMsg[5] = "Offer amount can not be same";  /* is the new offer greater than the current offer*/<br /> }<br /> <br /> $AlbumID = $HTTP_POST_VARS['AlbumID'];<br /> if(!$Error){   /* if there are no errors on input, we will send emails, and update or write a new message to database */<br /> // Error code ends here<br /> <br /> [/php]<br /> Further down I have this code in my Form<br /> [php]<br /> &lt;?php if($Error &amp;&amp; ($HTTP_POST_VARS["MM_update"] == "updateForm")){<br />                       if($ErrorMsg[0]){<br />                         echo "&lt;b&gt;$ErrorMsg[0] &lt;/b&gt;&lt;br&gt;";<br />                       }<br />                       if($ErrorMsg[1]){<br />                         echo "&lt;b&gt;$ErrorMsg[1] &lt;/b&gt;&lt;br&gt;";<br />                       }<br />                       if($ErrorMsg[2]){<br />                         echo "&lt;b&gt;$ErrorMsg[2] &lt;/b&gt;&lt;br&gt;";<br />                       }<br />                       if($ErrorMsg[3]){<br />                         echo "&lt;b&gt;$ErrorMsg[3] &lt;/b&gt;&lt;br&gt;";<br />                       }<br />                       if($ErrorMsg[4]){<br />                         echo "&lt;b&gt;$ErrorMsg[4] &lt;/b&gt;&lt;br&gt;";<br />                       }<br /> 					  if($ErrorMsg[5]){<br />                         echo "&lt;b&gt;$ErrorMsg[5] &lt;/b&gt;&lt;br&gt;";<br />                       }<br />                       } <br />                    ?&gt;<br /> <br /> <br /> [/php]<br /> Problems are:<br /> <br /> 1.) Error messages only (incorrectly as per 2 and 3) working when there is an bOffer with a value.<br /> <br /> 2.) If the b_offer is less than  bOffer , I am still getting error message saying "Offer amount can not be same <br /> " along with the error message "Enter a value greater than Last Offer " which is correct.<br /> <br /> 3.If there is no value in the bOffer, error messages aren't working - not showing at all<br /> <br /> You are welcome to have a look at <br /> [url]http://offerus.com/preport.php[/url]]]></description>
				<guid isPermaLink="true">https://proxy2.de/forum/posts/preList/2427/6416.php</guid>
				<link>https://proxy2.de/forum/posts/preList/2427/6416.php</link>
				<pubDate><![CDATA[Thu, 2 Oct 2003 01:18:34]]> GMT</pubDate>
				<author><![CDATA[ oavs]]></author>
			</item>
	</channel>
</rss>