Jump to content


Photo

PHP, HTML, and Forms...Oh my!


  • Please log in to reply
4 replies to this topic

#1 IronCannibal

IronCannibal
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 02 April 2006 - 06:53 PM

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.c...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
[!--coloro:#3333FF--][span style="color:#3333FF"][!--/coloro--][!--sizeo:2--][span style="font-size:10pt;line-height:100%"][!--/sizeo--]"Technological progress is like an axe in the hands of a pathological criminal."[!--sizec--][/span][!--/sizec--] - Albert Einstein [!--colorc--][/span][!--/colorc--]

#2 Desdinova

Desdinova
  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 02 April 2006 - 07:48 PM

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?

#3 txmedic03

txmedic03
  • Members
  • PipPipPip
  • Advanced Member
  • 313 posts
  • LocationCall, TX, USA

Posted 04 April 2006 - 05:23 AM

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.

SEMPER FIDELIS!

I can't stop you from doing something silly, but at least I can help you do it right.


#4 Guest_footballkid4_*

Guest_footballkid4_*
  • Guests

Posted 04 April 2006 - 06:33 AM

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.

#5 IronCannibal

IronCannibal
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 04 April 2006 - 11:31 PM

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.
[!--coloro:#3333FF--][span style="color:#3333FF"][!--/coloro--][!--sizeo:2--][span style="font-size:10pt;line-height:100%"][!--/sizeo--]"Technological progress is like an axe in the hands of a pathological criminal."[!--sizec--][/span][!--/sizec--] - Albert Einstein [!--colorc--][/span][!--/colorc--]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users