Help passing variables to other php pages

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike

    Help passing variables to other php pages

    Hello, I am trying to write a script to pass the value of the variable $cost
    to buy.php but I keep getting a parse error. Here is an example of what I am
    trying to do:

    $cost=5.45

    echo "<Form Action="buy.php ?Price=$cost" METHOD="POST">" ;

    Hope someone can help

    Thanks






  • Pertti Kosunen

    #2
    Re: Help passing variables to other php pages

    "Mike" <thereis@noemai l.com> wrote in message
    news:40572eb6$0 $28267$cc9e4d1f @news.dial.pipe x.com...[color=blue]
    > Hello, I am trying to write a script to pass the value of the variable[/color]
    $cost[color=blue]
    > to buy.php but I keep getting a parse error. Here is an example of what I[/color]
    am[color=blue]
    >
    > echo "<Form Action="buy.php ?Price=$cost" METHOD="POST">" ;[/color]

    echo "<Form Action=\"buy.ph p?Price=$cost\" METHOD=\"POST\" >";

    Add escape chars.


    Comment

    • Alvaro G Vicario

      #3
      Re: Help passing variables to other php pages

      *** Mike wrote/escribió (Tue, 16 Mar 2004 16:43:32 -0000):[color=blue]
      > echo "<Form Action="buy.php ?Price=$cost" METHOD="POST">" ;[/color]

      Some ideas:

      echo "<Form Action=\"buy.ph p?Price=$cost\" METHOD=\"POST\" >";

      echo '<Form Action="buy.php ?Price='.urlenc ode($cost).'" METHOD="POST">' ;

      echo '<Form Action="buy.php " METHOD="POST">' ;
      echo '<input type="hidden" name="Price" value="'.$cost. '">';


      --
      -- Álvaro G. Vicario - Burgos, Spain
      --

      Comment

      • Pedro Graca

        #4
        Re: Help passing variables to other php pages

        Mike wrote:[color=blue]
        > but I keep getting a parse error. Here is an example of what I am
        > trying to do:
        >
        > $cost=5.45
        >
        > echo "<Form Action="buy.php ?Price=$cost" METHOD="POST">" ;[/color]
        # ^_____________^ ^________^ ^_^

        try

        echo "<Form Action=\"buy.ph p?Price=$cost\" METHOD=\"POST\" >";
        # ^_____________--_______________ ____--________--____--_^
        --
        USENET would be a better place if everybody read: : mail address :
        http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
        http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
        http://www.expita.com/nomime.html : to 10K bytes :

        Comment

        • Allan Rydberg

          #5
          Re: Help passing variables to other php pages



          do it properly!

          print "<Form Action=\"buy.ph p?Price=" . $cost . "\" METHOD=\"POST\" >\n";


          Mike wrote:
          [color=blue]
          > Hello, I am trying to write a script to pass the value of the variable $cost
          > to buy.php but I keep getting a parse error. Here is an example of what I am
          > trying to do:
          >
          > $cost=5.45
          >
          > echo "<Form Action="buy.php ?Price=$cost" METHOD="POST">" ;
          >
          > Hope someone can help
          >
          > Thanks
          >
          >
          >
          >
          >
          >[/color]

          Comment

          • Richard Allsebrook

            #6
            Re: Help passing variables to other php pages

            Mike wrote:
            [color=blue]
            > Hello, I am trying to write a script to pass the value of the variable $cost
            > to buy.php but I keep getting a parse error. Here is an example of what I am
            > trying to do:
            >
            > $cost=5.45
            >
            > echo "<Form Action="buy.php ?Price=$cost" METHOD="POST">" ;
            >
            > Hope someone can help
            >
            > Thanks
            >
            >
            >
            >
            >
            >[/color]

            Dont mess about with escaping your quotes (\") it makes the code messy
            (IMHO) - try this instead:

            echo "<Form Action='buy.php ?Price=$cost' METHOD='POST'>" ;

            Hope this helps

            Comment

            • Submerged

              #7
              Re: Help passing variables to other php pages

              Mike wrote:[color=blue]
              > *Hello, I am trying to write a script to pass the value of th
              > variable $cost
              > to buy.php but I keep getting a parse error. Here is an example o
              > what I am
              > trying to do:
              >
              > $cost=5.45
              >
              > echo "<Form Action="buy.php ?Price=$cost" METHOD="POST">" ;
              >
              > Hope someone can help
              >
              > Thanks *[/color]

              sorry if this is below your level of intelligence, but i made thi
              mistake when i was JUST beginning to deal witht the whole variable i
              the URL stuff. Course, that was about 3 hours ago :P

              anyways, make sure that the form is in a .php file, if its in an htm
              file in wont work
              -
              Submerge
              -----------------------------------------------------------------------
              posted via www.WebFrustration.com

              Comment

              Working...