New to PHP looking for help
Moderator: General Moderators
-
Art Shotwell
- Forum Newbie
- Posts: 15
- Joined: Mon Mar 12, 2007 6:16 pm
- Location: Anacortes, Wash.
New to PHP looking for help
Hi, I've built a Web site for a friend... they want to add a magazine subsripting page. But, they have several different subscription rates: US, Canada, foreign, 1-, 2-, & 3-years, first class for US, Canada and foreign. I've never done anything in PHP and I've kinda chosen it because the credit card processor needs me to use it to pass subscription info to them. This should be easy, but I have no idea where to start. I've look at a couple online tutorials and I'm totally lost. I've laid out a page with the subscriptions info on it at http://www.nscalemagazine.com/subscribe2.html. Anyone willing to help out???
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: New to PHP looking for help
This entire community is willing to help. But you gotta start somewhere. Have you coded anything for this yet?Art Shotwell wrote:Anyone willing to help out???
-
Art Shotwell
- Forum Newbie
- Posts: 15
- Joined: Mon Mar 12, 2007 6:16 pm
- Location: Anacortes, Wash.
- iknownothing
- Forum Contributor
- Posts: 337
- Joined: Sun Dec 17, 2006 11:53 pm
- Location: Sunshine Coast, Australia
how are you passing subscriber information to the credit card processor? did they give you a direct link with some variables to use (eg. $name, $address, $phone), or do you email them the information along with an order number for example.
It sounds odd that they would use any method such as these, as it can potentially open them up to all kinds of problems. Do they not have their own page where a user submits their details, which your site would link to when a user clicks on "purchase subscription"?
It sounds odd that they would use any method such as these, as it can potentially open them up to all kinds of problems. Do they not have their own page where a user submits their details, which your site would link to when a user clicks on "purchase subscription"?
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
You're not viloating any rules yet. New folks to the forums always get a little leniency from me (only a little though
).
Seriously, before you get too far into coding, I would try looking for some tutorials on how to do what you want. There are lot of different way to achieve what you want, so it would make sense to get going in a direction then hit us up for help. Like I said, we are all more than willing to help.
Seriously, before you get too far into coding, I would try looking for some tutorials on how to do what you want. There are lot of different way to achieve what you want, so it would make sense to get going in a direction then hit us up for help. Like I said, we are all more than willing to help.
-
Art Shotwell
- Forum Newbie
- Posts: 15
- Joined: Mon Mar 12, 2007 6:16 pm
- Location: Anacortes, Wash.
I don't need to pass any subscriber information, that will be filled out on a form hosted by CyberSource, the processor. I use a security script generated by them, hop.php, to pass vendor information, total amount and tax amount, along with a couple other fields which I have added for the vendor. Because their script needs to have the total amount and tax amount passed in a php script, my intent was to use a single html page, with maybe radio buttons, for a subscriber to choose among the subscription choices, then to post that another page that will, in turn, post to the CyberSource hosted order page.iknownothing wrote:how are you passing subscriber information to the credit card processor? did they give you a direct link with some variables to use (eg. $name, $address, $phone), or do you email them the information along with an order number for example.
It sounds odd that they would use any method such as these, as it can potentially open them up to all kinds of problems. Do they not have their own page where a user submits their details, which your site would link to when a user clicks on "purchase subscription"?
-
Art Shotwell
- Forum Newbie
- Posts: 15
- Joined: Mon Mar 12, 2007 6:16 pm
- Location: Anacortes, Wash.
I have looked at several tutorials, but because I'm new to scripting languages, it's mostly Greek. My tendancy would be to use radio buttons to choose from among: US subscriptions, Canadian and Foreign subscriptions; then shipping to Washington state address; then 1 year, 2 years or 3 years; then regular second class or first class; with someway to add sales tax for Washington subscriptions, then pass along the total cost & tax (that's the way Cybersouce wants it) via post to their site.Everah wrote:You're not viloating any rules yet. New folks to the forums always get a little leniency from me (only a little though).
Seriously, before you get too far into coding, I would try looking for some tutorials on how to do what you want. There are lot of different way to achieve what you want, so it would make sense to get going in a direction then hit us up for help. Like I said, we are all more than willing to help.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
-
Art Shotwell
- Forum Newbie
- Posts: 15
- Joined: Mon Mar 12, 2007 6:16 pm
- Location: Anacortes, Wash.
Hah! My first attempt was the lazy way. I created a page with the options and links to a separate page with the cost hard-coded into the page and the hop.php from there. My background is actually as a UI designer, with next to no coding background. I use Dreamweaver. No real coding background, except to tweak or fix Dreamweaver code. I'll work on a form.Everah wrote:Seems straightforward enough. Do you at least have an HTML form that we could see. The HTML, not the rendering of the HTML.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
-
Art Shotwell
- Forum Newbie
- Posts: 15
- Joined: Mon Mar 12, 2007 6:16 pm
- Location: Anacortes, Wash.
Okay, here are forms from two pages. I've removed most of the html to make the forms easier to read. I need the second page because the line with the InsertSignature in it needs the total sales amount. What I've got her lacks is: no way to add sales tax for Washington deliveries. I could add four more radio inputs, but that seems inelegant. I need to be able to move from the first page to the second: total amount, tax amount, description of what's being purchased.
---------------subscribe.html-----------------
---------------order.php--------------
---------------subscribe.html-----------------
Code: Select all
<form action="order.php" method=post>
<p><strong>United States delivery address (We add sales tax for Washington state shipping addresses)</strong></p>
<p><input type=radio name="subscribe" value="domestic_1_year">1 year - $28.00<br>
<input type=radio name="subscribe" value="domestic_2_years">2 years - $53.50<br>
<input type=radio name="subscribe" value="domestic_3_years">3 years - $79.00</p>
<p><strong>Foreign & Canada</strong></p>
<p><input type=radio name="subscribe" value="foreign_1_year">1 year - $32.00<br>
<input type=radio name="subscribe" value="foreign_2_years">2 years - $61.50<br>
<input type=radio name="subscribe" value="foreign_3_years">3 years - $91.00</p>
<p><strong>First Class</strong></p>
<p><input type=radio name="subscribe" value="domestic_first_class">U.S. & Canada: 1 year - $42.00<br>
<input type=radio name="subscribe" value="foreign_first_class">Foreign: 1 year - $64.00</p>
<p><input type=submit name="submit" value="Continue"> <input type=reset value="Clear"></p>Code: Select all
<?php include("HOP.php") ?>
<?
$amount=$_POST["total_amount"];
?>
<?
$taxamount=$_POST["taxamount"];
?>
<html>
<form action="https://orderpage.ic3.com/hop/orderform.jsp" method=post>
<?php InsertSignature($amount, "usd") ?>
Your total charge will be <?php echo $amount; ?>
<input type=radio name="merchantDefinedData1" value="new"> New Subscription?</p>
<input type=radio name="merchantDefinedData1" value="renewal"> Renewal Subscription </p>
If Renewal, please enter account number
<input name="merchantDefinedData2" size=15 maxlength=20></p>
<input type=submit name="submit" value="Checkout">
<input type=reset name="reset" value="Clear"> </p>
<input type=hidden name="orderPage_transactionType" value="sale">
<input type=hidden name="comments" value="1 year subscription, standard delivery">
</form>- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Code: Select all
<?php
include("HOP.php");
// These should be run through an isset() check
$amount = $_POST["total_amount"];
$taxamount = $_POST["taxamount"];
?>
<html>
<form action="https://orderpage.ic3.com/hop/orderform.jsp" method=post>
<?php InsertSignature($amount, "usd"); ?>
Your total charge will be <?php echo $amount; ?>
<input type=radio name="merchantDefinedData1" value="new"> New Subscription?</p>
<input type=radio name="merchantDefinedData1" value="renewal"> Renewal Subscription </p>
If Renewal, please enter account number
<input name="merchantDefinedData2" size=15 maxlength=20></p>
<input type=submit name="submit" value="Checkout">
<input type=reset name="reset" value="Clear"> </p>
<input type=hidden name="orderPage_transactionType" value="sale">
<input type=hidden name="comments" value="1 year subscription, standard delivery">
</form>-
Art Shotwell
- Forum Newbie
- Posts: 15
- Joined: Mon Mar 12, 2007 6:16 pm
- Location: Anacortes, Wash.
I think I can do that...but...if they're not set, then we're losing necessary data for the transaction. And, they should be set in the POST from the html. Of course, they're not in my html 'cause I don't know how to use them. I got that code from CyberSource support.Everah wrote:Code: Select all
<?php include("HOP.php"); // These should be run through an isset() check $amount = $_POST["total_amount"]; $taxamount = $_POST["taxamount"]; ?>
My problem first, though, is how to get the first page running...
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
That is why you check that they are set. If they are not, then you really shouldn't processing the form data, right?Art Shotwell wrote:I think I can do that...but...if they're not set, then we're losing necessary data for the transaction.
You mean like pushing that information from the first form to the second form so they are already filled out in the second form?Art Shotwell wrote:And, they should be set in the POST from the html. Of course, they're not in my html 'cause I don't know how to use them. I got that code from CyberSource support.
The first page is only a form, correct? Can it be static HTML to start?Art Shotwell wrote:My problem first, though, is how to get the first page running...
-
Art Shotwell
- Forum Newbie
- Posts: 15
- Joined: Mon Mar 12, 2007 6:16 pm
- Location: Anacortes, Wash.
The first page IS html. I had thought I'd have to change it to php to move the form results to the second page. I can set the form radio values to dollars/cents and, thus, move the price to the second page. But, I also want to be able to move a description for each item. I want to be able to echo the description and price for the item. Also move the description to the card processor. too. And, I haven't figured out how to add state tax to people who say they're ordering subscriptions for Washington state.