Page 2 of 3
Re: discount voucher how to set up using php
Posted: Wed May 08, 2013 4:12 pm
by jonnyfortis
Does it work with the very first code in the table? Because with
no nothing is showing when the form is submitted.
in the DB table i have two columns
VID tinyint(4) auto_increment
VCode varchar(20)
Re: discount voucher how to set up using php
Posted: Thu May 09, 2013 8:07 am
by Christopher
Do you know what is in $_POST['vouchCode'] and $row_rsVoucher['VCode'] ?
Re: discount voucher how to set up using php
Posted: Thu May 09, 2013 8:19 am
by jonnyfortis
Do you know what is in $_POST['vouchCode'] and $row_rsVoucher['VCode'] ?
i only have one record added at the moment
VID 1
VCode lot123£10
Re: discount voucher how to set up using php
Posted: Thu May 09, 2013 1:47 pm
by Christopher
jonnyfortis wrote:
i only have one record added at the moment
VID 1
VCode lot123£10
So that's what is in the database. Buhe what are the values of $_POST['vouchCode'] and $row_rsVoucher['VCode'] ? Is the value above loaded? What is passed in the form field?
Re: discount voucher how to set up using php
Posted: Thu May 09, 2013 2:18 pm
by jonnyfortis
So that's what is in the database. Buhe what are the values of $_POST['vouchCode'] and $row_rsVoucher['VCode'] ? Is the value above loaded? What is passed in the form field?
so i should try and echo them out?
Re: discount voucher how to set up using php
Posted: Thu May 09, 2013 3:39 pm
by Christopher
That is one way to see the values. Try it!

Re: discount voucher how to set up using php
Posted: Fri May 10, 2013 8:19 am
by jonnyfortis
i added the following to the shopping cart
Code: Select all
<?php echo $_POST['vouchCode']; ?><br />
<?php echo $row_rsVoucher['VCode']; ?> <br />
and before i have hit submit i get the following results
then if i add the only discount value i have at the moment
lot123£10 to the form and submit it i get the following results
lot123£10
lot123�10
Re: discount voucher how to set up using php
Posted: Fri May 10, 2013 12:17 pm
by Christopher
So those don't look the same. What is that character in the database between "lot123" and "10" ?
Re: discount voucher how to set up using php
Posted: Fri May 10, 2013 1:03 pm
by jonnyfortis
Code: Select all
So those don't look the same. What is that character in the database between "lot123" and "10" ?
i dont know thats not what is stored in the DB...it must be an encoding issue?
Re: discount voucher how to set up using php
Posted: Fri May 10, 2013 3:50 pm
by Christopher
Well ... the values in the database need to be able to match the values that can be entered in the form. How do you enter the voucher codes into the database?
Re: discount voucher how to set up using php
Posted: Fri May 10, 2013 4:49 pm
by jonnyfortis
Christopher wrote:Well ... the values in the database need to be able to match the values that can be entered in the form. How do you enter the voucher codes into the database?
via a form in the backend of the website but they go into the DB correctly
Re: discount voucher how to set up using php
Posted: Fri May 10, 2013 11:39 pm
by Christopher
Looks like either your database table/field is not UTF8 (try utf8_general_ci) or maybe the sprintf() or some other function is causing the problem. Maybe try concatenating instead of sprintf().
Re: discount voucher how to set up using php
Posted: Mon May 13, 2013 11:22 am
by jonnyfortis
i tried changing UTF8 to charset= "utf8_general_ci" as suggested but am now getting errors
Code: Select all
Warning: Cannot modify header information - headers already sent by (output started at /homepages/6/d330188495/htdocs/beta/shopping-cart.php:1) in /homepages/6/d330188495/htdocs/beta/shopping-cart.php on line 4
Warning: Cannot modify header information - headers already sent by (output started at /homepages/6/d330188495/htdocs/beta/shopping-cart.php:1) in /homepages/6/d330188495/htdocs/beta/shopping-cart.php on line 5
Warning: Cannot modify header information - headers already sent by (output started at /homepages/6/d330188495/htdocs/beta/shopping-cart.php:1) in /homepages/6/d330188495/htdocs/beta/shopping-cart.php on line 6
Warning: Cannot modify header information - headers already sent by (output started at /homepages/6/d330188495/htdocs/beta/shopping-cart.php:1) in /homepages/6/d330188495/htdocs/beta/shopping-cart.php on line 7
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /homepages/6/d330188495/htdocs/beta/shopping-cart.php:1) in /homepages/6/d330188495/htdocs/beta/XCInc/XCart.inc on line 4
and these lines of code are
Code: Select all
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache");
Re: discount voucher how to set up using php
Posted: Mon May 13, 2013 12:26 pm
by Christopher
jonnyfortis wrote:i tried changing UTF8 to charset= "utf8_general_ci" as suggested but am now getting errors
You changed the character coding in your database table? Or for your HTML document?
jonnyfortis wrote:Code: Select all
Warning: Cannot modify header information - headers already sent by (output started at /homepages/6/d330188495/htdocs/beta/shopping-cart.php:1) in /homepages/6/d330188495/htdocs/beta/shopping-cart.php on line 4
...
[syntax=php]header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache");
It says the there is output before line 4 in that file. So what is before the first header() call you list above (if that is line 4)?
Re: discount voucher how to set up using php
Posted: Mon May 13, 2013 12:37 pm
by jonnyfortis
Christopher wrote:jonnyfortis wrote:i tried changing UTF8 to charset= "utf8_general_ci" as suggested but am now getting errors
You changed the character coding in your database table? Or for your HTML document?
jonnyfortis wrote:Code: Select all
Warning: Cannot modify header information - headers already sent by (output started at /homepages/6/d330188495/htdocs/beta/shopping-cart.php:1) in /homepages/6/d330188495/htdocs/beta/shopping-cart.php on line 4
...
[syntax=php]header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache");
It says the there is output before line 4 in that file. So what is before the first header() call you list above (if that is line 4)?
i changed the html document
the only code above this is
Code: Select all
<?php require_once('Connections/lotties.php'); ?>
<?php
// do not cache
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache");