SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: php variable

  1. #1
    SitePoint Guru
    Join Date
    Mar 2001
    Location
    Highlands Ranch, Colorado
    Posts
    614
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php variable

    Well, I am still working on my authorize.net script - step by step.

    As I will need to send the $$$ amount to charge to the gateway through my system I need to specify the amount and give it a variable. How do I do that?

    Here are more details. The client wants to register a domain name for 1 year (just as an example). I store the registration period in MySQL as "$period". Further down in my order form I use

    PHP Code:
    if ($period == 1) {  echo("Registration fee: $15.00"); } 
    to translate the registration period into a dollar amount and to display it on the web site (hardcoded - so the client cannot change it). So, when the web form is being submitted I need to translate the $15.00 into the variable that authorize.net expects me to send the actual amount "x_Amount".

    That's where I am loosing it. How would I do that?

    Thanks!

    Christoph

  2. #2
    SitePoint Evangelist AlexC's Avatar
    Join Date
    Oct 2000
    Location
    Sheffield, UK
    Posts
    437
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, don't quote me on this, but you could probably use session variables to do this - i'm not good with session variables, but you should be able to do something like

    you'll need to either work it out, or wait for a session-clever person to get the rest

    page1.php
    PHP Code:
    session_start();
    $_SESSION['amount'] = '15.00'
    page2.php

    PHP Code:
    session_start();
    echo 
    $_SESSION['amount']; 
    session_start(); MUST GO before anything else that outputs to the screen... i'll test it and be back in a minute

    edit: added session_start(); to second piece of code, tested and it works ;-)

    Alex
    Last edited by AlexC; Dec 29, 2002 at 13:30.
    Nearly 7 years old!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •