PDA

View Full Version : Forms in PHP



csharpdotcom
12-07-2004, 06:01 PM
Hi All,

This is my very first posting on this forum, and would most appreciate some kind help. I am in the process of learning PHP, but do not know ASP, and my subscription does not support the latter, but my Westhost subscription does support PHP.

I am trying to link in a page with a website for payment via Authorize.net. They provide scripts in ASP, Perl and PHP, and I am using the latter. However, there is one line of ASP embedded in the HTML form code that links to their secure payment gateway, but I am not sure how to convert it to PHP, as I know no ASP.

Here is the code:

<FORM METHOD=POST ACTION="https://secure.authorize.net/gateway/transact.dll">
<% ret = InsertFP (loginid, txnkey, amount, sequence) %>
<INPUT TYPE=HIDDEN NAME="x_login" VALUE="your login ID goes here">
<INPUT TYPE=HIDDEN NAME="x_show_form" VALUE="PAYMENT_FORM">
<INPUT TYPE=HIDDEN NAME="x_amount" VALUE="amount goes here">
<INPUT TYPE=SUBMIT VALUE="Click here for secure payment form">
</FORM>

I replaced the 3rd line by:

<?PHP $ret = InsertFP($loginid, $txnkey, $amount, $sequence) ?>

Is that correct, and what does InsertFP mean?

I put in a dummy 99.99 for the amount, and my login ID in the place required.

Additionally, I downloaded three PHP files for the SIM interface from Authorize.net, one of which required my user ID and a transaction key to be entered, which I did. These files are in the same directory as the form is located.

On clicking on the form I get an error message. I would appreciate it if you could help me with the PHP. In the mean time I am trying to get help from Authorize.net on the linking and the errors.

Many thanks,

Christopher Sharp
http://csharp.com

wildjokerdesign
12-07-2004, 06:28 PM
Chirstopher,

What does the rest of the page that the form is on look like. Is a php page or just plain html. What you did may be correct but unless someplace else there is a call to the file that has more info and functions it would not work or if that is in the page you have this form on. If they provide a php way to access their service I wouldn't think it would include an ASP call in it.

Are you able to get other php scripts to work on you site? You might need to install Mod_php which is under Site Applications - Development in your Site Manager.

l0s3r
01-24-2005, 06:49 PM
Chris

the line you inserted :-

<?PHP $ret = InsertFP($loginid, $txnkey, $amount, $sequence) ?>

you might want to try adding a semi colon so it becomes :-

<?PHP $ret = InsertFP($loginid, $txnkey, $amount, $sequence); ?>

Lines of code in php are terminated with a semi-colon.

Hope this cures your problem, if not, could you cut and paste the error message ?

K.

jalal
01-25-2005, 07:23 AM
Hi Christopher

ASP and PHP are different. You cannot take ASP code and run it under PHP, it will need to be rewritten. You may want to ask Authorize.net if they have some examples that run in PHP, or ask on their forums (if they have such a thing).

Also, when seeking help on the forum it is good to give a little more detail on what went wrong, what the error message was (usually a good clue to the problem) and what you had expected to happen had all gone correctly.

HTH