Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Smarty Help

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 09-20-2005, 02:43 PM
 
mikefeiman mikefeiman is offline
 

Member
  
Join Date: Jan 2005
Posts: 23
 

Default Smarty Help

I'm trying to create a form that passes information within it self to validate if a field has been populated with information. Can any one point out why this code may not work?

Code:
{php} if ($GLOBALS["HTTP_GET_VARS"]["B2"] == "Reset") echo "Reset"; $process = ($GLOBALS["HTTP_GET_VARS"]["B1"] == "Submit"); $ok = "ok"; $msg = " There are errors:"; if ($process) { // check first name FIRST_NAME $firstname = ($GLOBALS["HTTP_GET_VARS"]["FIRST_NAME"]); if ($firstname == '') { $ok = 'not ok'; $msg .= " First name cannot be blank"; } } else { $firstname = ""; } {/php} <form name="b1" action="{php} echo "$form"; {/php}" method="post"> {php} if ($ok == 'not ok') printf('<span class="error">%s</span> ', $msg); {/php} First Name <input class="form3" size="30" name="FIRST_NAME" type=text value="{php} echo $firstname;{/php}"> <input type="submit" value="Submit" name="B1" class="button"> </form>
__________________
Billiard Exchange
Version 3.5.4
Reply With Quote
  #2  
Old 09-28-2005, 01:33 AM
 
sanj-xcart sanj-xcart is offline
 

Member
  
Join Date: Sep 2005
Location: London, UK
Posts: 28
 

Default

Hi Mike,

I can't give you a full solution, but you may be getting an error due to the use of $HTTP_GET_VARS.

Try using $_POST, or if you are running php version prior to 4.1.0, use $HTTP_POST_VARS. (Note that the form contains post variables in your code).

You can find out more on global variables in php here:

http://uk2.php.net/reserved.variables

Otherwise, the only other potential issue I can see is the variable $form. This is undefined, but I imagine that is more to do with the fact that it is defined in another snippet of code.

Good luck!

Sanj
__________________
X-Cart Gold 4.0.16, 4.0.17
X-AOM 4.0.16, 4.0.17
X-Affiliate 4.0.16, 4.0.17
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 10:17 PM.

   

 
X-Cart forums © 2001-2020