Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

force lower-case letters in text boxes?


Guest

Recommended Posts

Posted

is this possible in php? the javascript i tried to use had a (); which of course interfered with the ending of the php echo for the oscommerce text box.

Posted

this is where i'm confused...

 

 

i have:

<?php echo tep_draw_input_field('coupon_code', '', ' size="30"'); ?>

 

 

the code:

$str = strtolower($str);

 

 

the ; cancels it out :(

Posted
this is where i'm confused...

i have:

<?php echo tep_draw_input_field('coupon_code', '', ' size="30"'); ?>

the code:

$str = strtolower($str);

the ; cancels it out :(

 

If you want to enforce lowercase in PHP, it must happen after the form is submitted. This would be before.

Contributions

 

Discount Coupon Codes

Donations

Posted
What exactly do you need to do?

the coupon contribution i'm using only works if the coupon code is entered in lowercase letters, so in order to avoid confusion i need to force lowercase for the code input box

 

If you want to enforce lowercase in PHP, it must happen after the form is submitted. This would be before.

where exactly would the lowercase-force code have to go, in the form action?

 

in case you can't tell, i'm dumb as a doornail with php :lol:

Posted
where exactly would the lowercase-force code have to go, in the form action?

 

Can't tell you for sure, since I don't know the contribution.

 

Look for something like

 

tep_db_prepare_input($HTTP_POST_VARS['coupon_code'])

 

at the top of the file. This would need to become

 

tep_db_prepare_input(strtolower($HTTP_POST_VARS['coupon_code']))

Contributions

 

Discount Coupon Codes

Donations

Posted

i tried:

<?php echo tep_draw_input_field(strtolower('coupon_code', '', ' size="30"')); ?>

 

in place of:

<?php echo tep_draw_input_field('coupon_code', '', ' size="30"'); ?>

 

 

got the error:

Warning: Wrong parameter count for strtolower()

Posted

<?php echo tep_draw_input_field(strtolower('CAPITAL_STRING'), '', ' size="30"'); ?>

Posted

no errors this time, but now the coupon don't work :(

Posted

what coupon? I am not sure why you want to change the name of the form to lower case. Or you want to change the content of the input box?

 

 

<?php echo tep_draw_input_field('coupon_code', strtolower('DEFAULT_TEXT_GOES_HERE'), ' size="30"'); ?>

Posted

ohhh, no i did not mean i want to change the NAME of the form, i meant i need to change whatever the user TYPES to lowercase

Posted
Look for something like

 

tep_db_prepare_input($HTTP_POST_VARS['coupon_code'])

 

at the top of the file. This would need to become

 

tep_db_prepare_input(strtolower($HTTP_POST_VARS['coupon_code']))

 

It will be at the top of the page, or at the top of the page that this form posts to. tep_draw_input_field() creates a text box. You need to edit the data returned from the text box.

Contributions

 

Discount Coupon Codes

Donations

Posted

my bad, so it would be something like:

 

if ((isset($_POST['coupon_code'])) and ($_POST['coupon_code'] != '')) {

switch (strtolower($_POST['coupon_code'])) {

 

 

the strtolower was still there, but any coupons typed in caps never came through.. odd. maybe it's a deal with the contribution, i'll ask in the support thread

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...