latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Free subscription coupon – again!

Home Forums Community Forum Free subscription coupon – again!

This topic contains 6 replies, has 3 voices. Last updated by  Cristián Lávaque 4 years, 8 months ago.

Topic Author Topic
Posted: Tuesday May 1st, 2012 at 4:00 pm #12311
Nigel
Username: enquirer32

Oops! Something seems to have gone wrong… Was worknig fine but not any more. Whether a person completes the coupon code correctly or not they see the free registration details AND the paid all in one page. There is no cut off. I am using the PHP Execution plugin. I have set it up as described… just not working any more… what might have gone wrong? Any ideas much appreciated.

Just be clear. I have a form on one page where a person has to submit the coupon they have received. This then takes them to a page with the php stuff and the url is good – in other words it is the url PLUS the voucher e.g. subscribe_voucher/?voucher=free. If a person submits the wrong coupon it takes them to the SAME url e.g subscribe_voucher/?voucher=free. Then there is the stuff about having a voucher and stuff about paid subscriptions all on one page which is very confusing…

Sorry because having written all of this I realise this isn’t really a core problemo.

EDIT: OK, I think the problem is in my form. I have:

Do you think it should read:

  • This topic was modified 4 years, 8 months ago by  Nigel.

List Of Topic Replies

Viewing 6 replies - 1 through 6 (of 6 total)
Author Replies
Author Replies
Posted: Wednesday May 2nd, 2012 at 4:34 am #12352

I don’t see anything where you seem to have quoted a code or something, it’s just an empty line. Did you solve it?

Posted: Thursday May 3rd, 2012 at 5:23 am #12442
Nigel
Username: enquirer32

I didn’t use the code thingy…

<form id="voucherForm" action="http://mysite/subscribe_voucher/?voucher=" method="post"><input type="text" name="voucher" value="" maxlength="15" /> <input id="saveForm" type="submit" name="submit" value="submit" /> <input type="reset" value="Reset" /></form>

This isn’t transferring the code to the url – I can cheat my hard-coding it e.g.

<form id="voucherForm" action="http://magazine.finewinepress.com/subscribe_voucher/?voucher=free" method="post"><input type="text" name="voucher" value="" maxlength="15" /> <input id="saveForm" type="submit" name="submit" value="submit" /> <input type="reset" value="Reset" /></form>

but effectively anyone can type anything…

Posted: Thursday May 3rd, 2012 at 1:13 pm #12486
Raam Dev
Username: Raam
Staff Member

Hi Nigel,

The form where they submit the voucher code should submit to the page where you check if the voucher code is correct.

So if you have a page called /submit-voucher/, you’d put this code on there:

<form id="voucherForm" action="/sign-up/" method="post">
<input type="text" name="voucher" value="" maxlength="15" />
<input id="saveForm" type="submit" name="submit" value="submit" /> 
<input type="reset" value="Reset" /></form>

Notice the action is set to submit the form to another page (/sign-up/), which is where you’d put some PHP code to check if the voucher they submitted is correct. If it’s correct, you show the Pro-Form Free Registration Form. Otherwise, you can show the paid form:

<?php if (isset($_GET['voucher']) && $_GET['voucher'] == 'free') { ?>
	Show the free registration form. (free registration shortcode would go here)
<?php } else { ?>
	Show the payment form. (paid pro-form shortcode would go here)
<?php } ?>
Posted: Thursday May 3rd, 2012 at 3:33 pm #12509

Actually it’d be [hilite mono]$_POST['voucher'][/hilite] in the code, or [hilite mono]method="get"[/hilite] in the form. I make that mistake sometimes. :)

Posted: Friday May 4th, 2012 at 6:54 am #12576
Nigel
Username: enquirer32

Thanks – looking at first part for the time being and yes it’s method=”get”.

All works perfectly. This is very useful so many thanks for your input. It’s complicated keeping track of the pages though esp. if one has more than one coupon! One could write a plugin just for that.

  • This reply was modified 4 years, 8 months ago by  Nigel.
  • This reply was modified 4 years, 8 months ago by  Nigel.
Posted: Friday May 4th, 2012 at 6:40 pm #12616

Cool. Glad we could help. :)

Viewing 6 replies - 1 through 6 (of 6 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.