Jump to content

Recommended Posts

I am trying to figure out how I can collect a value from one line of a form and write that value to a flat file.

The form is a PayPal button. So, it points to PayPal. I'm wondering if I should point it to my own PHP script then to PayPal, or can I just capture one value without this extra step?

Here is the HTML form:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="paypal">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="test@test.net">
<input type="hidden" name="item_name" value="Pay me now">
<input type="hidden" name="item_number" value="xyz123">
<input type="text" name="amount" size="4" maxlength="7">
<input type="submit" name="submit" value="Submit">
</form>

I need to capture the amount that they enter for their payment and write that to a flat file. Then I'm taking that file and adding it to some nifty flash animation.

Any ideas?
IC
Link to comment
https://forums.phpfreaks.com/topic/6407-php-html-and-formsoh-my/
Share on other sites

well I see a few options..

one is get an onclick event on the submit button opening a page which gives you the var.
one is get a page collecting the data, doing your stuff, then continue with a header location through get.
one is get a page collecting the data, filling it into a hidden form, doing your stuff, then body onload submit form.

however, none of these I consider to be 'neat'. Aren't there any other ways you can think of?
Link to comment
https://forums.phpfreaks.com/topic/6407-php-html-and-formsoh-my/#findComment-23220
Share on other sites

How about going to a second page which calls a fsock_open() to send the data to the paypal page and write the other data to the flat file and pull up the flash page. I'm really not sure exactly what you want to do with all of this, but you could use a socket connection to send the request to the pay pal server and possibly return the results back to the browser. I haven't used sockets under PHP very much or in quite some time for that matter. I used them a lot under other languages.
Link to comment
https://forums.phpfreaks.com/topic/6407-php-html-and-formsoh-my/#findComment-23736
Share on other sites

Guest footballkid4
If you wanted to use an fsockopen to the PayPal page, then they would have to supply their email and password on your site too. The way you are trying to do this is fairly bad from the way I see it. What if a user types an amount in the box, gets forwarded to PayPal, but never actually finished off the transaction. Then it looks like you have more money than you really did.

Is it really that hard to just check your account from time to time and see how much money you're making? Aside from that, PayPal should send you emails when you recieve payments...maybe you can use a PHP script to check the email, make sure it's from that site, and then add it to the flat file.
Link to comment
https://forums.phpfreaks.com/topic/6407-php-html-and-formsoh-my/#findComment-23744
Share on other sites

I figured out a way, now I just need to figure out the Actionscript for Flash.

PayPal has their IPN system that I can use to have the finished transaction written to a MySQL DB. So, I just need to set it up so that when someone refreshes the page, a script check the DB for new donations, adds them to the old and displays the amount in Flash.

Hmmm....now, how to do that?

Maybe a PHP script can be triggered to check the DB and write the new total to the flat file so that Flash can use it? Maybe I'm in way over my head.
Link to comment
https://forums.phpfreaks.com/topic/6407-php-html-and-formsoh-my/#findComment-24019
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.