further on my fairly simple logic problem

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

    further on my fairly simple logic problem

    > You can pass parameters in the URL for a POSTed form:[color=blue]
    >
    > ## page2
    > <form method="post" action="page3.p hp?data=$urlenc oded_data">
    > <input type="text" name="address">
    > <input type="submit">
    > </form>
    >
    > ## page3
    > mail('your_addr ess@example.com ', 'form data with contact details',
    > "Someone entered this data:\n\n" .
    > "{$_GET['data']}\n\n" .
    > "The user details are:\n" .
    > " address: {$_POST['address']}");[/color]

    Thanks for all the previous help guys!

    I'm halfway there, I think. I'm getting my POST data through to the
    next page, but I'm not sure how or if I can use the URLENCODE command within
    the form? Whereas I used to have the data passed on like so:

    echo '<a href="mail.php? radiochoice=', urlencode($radi obutton),
    '&radiomoderntr ad=', urlencode($radi omoderntrad),
    '&radiocoord= ', urlencode($radi ocoord),
    '&radiopacking= ', urlencode($radi opacking),
    '&i1=', urlencode($item 1),
    '&i2=', urlencode($item 2),
    '&i3=', urlencode($item 3),
    '&i4=', urlencode($item 4),
    '&i5=', urlencode($item 5),
    '&i6=', urlencode($item 6), ETC.

    when I try to do a (obviously botched?!) cut and paste job to get the
    following:

    <form name="form1" method="post" action="finalte st.php?stevetes t=",
    urlencode($item 1),' stevetest2=', urlencode($item 2),'">
    <p>

    <input type="text" name="textfield ">
    </p>
    <p>
    <input type="submit" name="submit" value="Submit">
    </p>
    </form>?>

    I get a 'Parse error: parse error, unexpected '<'' - yes, my grasp is syntax
    is pretty crappy, but I'm no programmer - just a GFX guy trying to learn!
    Anyone able to help me mastering this last piece of my jigsaw?

    THANKS!

    Steve



  • kingofkolt

    #2
    Re: further on my fairly simple logic problem

    "Steve" <luckylucky200@ hotmail.com> wrote in message
    news:40ae0206$0 $47310$c3e8da3@ news.astraweb.c om...[color=blue][color=green]
    > > You can pass parameters in the URL for a POSTed form:
    > >
    > > ## page2
    > > <form method="post" action="page3.p hp?data=$urlenc oded_data">
    > > <input type="text" name="address">
    > > <input type="submit">
    > > </form>
    > >
    > > ## page3
    > > mail('your_addr ess@example.com ', 'form data with contact details',
    > > "Someone entered this data:\n\n" .
    > > "{$_GET['data']}\n\n" .
    > > "The user details are:\n" .
    > > " address: {$_POST['address']}");[/color]
    >
    > Thanks for all the previous help guys!
    >
    > I'm halfway there, I think. I'm getting my POST data through to the
    > next page, but I'm not sure how or if I can use the URLENCODE command[/color]
    within[color=blue]
    > the form? Whereas I used to have the data passed on like so:
    >
    > echo '<a href="mail.php? radiochoice=', urlencode($radi obutton),
    > '&radiomoderntr ad=', urlencode($radi omoderntrad),
    > '&radiocoord= ', urlencode($radi ocoord),
    > '&radiopacking= ', urlencode($radi opacking),
    > '&i1=', urlencode($item 1),
    > '&i2=', urlencode($item 2),
    > '&i3=', urlencode($item 3),
    > '&i4=', urlencode($item 4),
    > '&i5=', urlencode($item 5),
    > '&i6=', urlencode($item 6), ETC.
    >
    > when I try to do a (obviously botched?!) cut and paste job to get the
    > following:
    >
    > <form name="form1" method="post" action="finalte st.php?stevetes t=",
    > urlencode($item 1),' stevetest2=', urlencode($item 2),'">
    > <p>
    >
    > <input type="text" name="textfield ">
    > </p>
    > <p>
    > <input type="submit" name="submit" value="Submit">
    > </p>
    > </form>?>
    >
    > I get a 'Parse error: parse error, unexpected '<'' - yes, my grasp is[/color]
    syntax[color=blue]
    > is pretty crappy, but I'm no programmer - just a GFX guy trying to learn!
    > Anyone able to help me mastering this last piece of my jigsaw?
    >
    > THANKS!
    >
    > Steve
    >
    >[/color]

    Steve --
    You have HTML in the middle of a PHP block. What you would have do is take
    the HTML form out of the PHP block and then put small PHP blocks in the
    middle of the form action to print the urlencodes. Example:

    <?php
    // define $item's here:
    $item1="foo";
    $item2="bar";
    ?>

    <form name="form1" method="post" action="finalte st.php?stevetes t=<?php print
    urlencode($item 1); ?>&stevetest2=< ?php print urlencode($item 2); ?>">
    <p>

    <input type="text" name="textfield ">
    </p>
    <p>
    <input type="submit" name="submit" value="Submit">
    </p>
    </form>

    hope this helped

    - JP


    Comment

    • Pedro Graca

      #3
      Re: further on my fairly simple logic problem

      Steve wrote:
      (snip)[color=blue]
      > when I try to do a (obviously botched?!) cut and paste job to get the
      > following:[/color]

      Where is the initial php tag?
      The one that refers to the last "?>" you posted?
      [color=blue]
      > <form name="form1" method="post" action="finalte st.php?stevetes t=",
      > urlencode($item 1),' stevetest2=', urlencode($item 2),'">
      > <p>
      >
      > <input type="text" name="textfield ">
      > </p>
      > <p>
      > <input type="submit" name="submit" value="Submit">
      > </p>
      > </form>?>
      >
      > I get a 'Parse error: parse error, unexpected '<''[/color]

      Where?
      [color=blue]
      > Anyone able to help me mastering this last piece of my jigsaw?[/color]

      Try this:

      <?php
      echo '<form name="form1" method="post" action="finalte st.php?';
      echo 'stevetest=', urlencode($item 1), '&';
      echo 'stevetest2=', urlencode($item 2), '">';
      echo '<p><input type="text" name="textfield "></p>';
      echo '<p><input type="submit" name="submit" value="Submit"> </p>';
      echo '</form>';
      ?>

      Or, as another poster said, separate the HTML from the PHP.

      --
      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

      • Steve

        #4
        Re: further on my fairly simple logic problem

        > >[color=blue]
        >
        > Steve --
        > You have HTML in the middle of a PHP block. What you would have do is take
        > the HTML form out of the PHP block and then put small PHP blocks in the
        > middle of the form action to print the urlencodes. Example:
        >
        > <?php
        > // define $item's here:
        > $item1="foo";
        > $item2="bar";
        > ?>
        >
        > <form name="form1" method="post" action="finalte st.php?stevetes t=<?php[/color]
        print[color=blue]
        > urlencode($item 1); ?>&stevetest2=< ?php print urlencode($item 2); ?>">
        > <p>
        >
        > <input type="text" name="textfield ">
        > </p>
        > <p>
        > <input type="submit" name="submit" value="Submit">
        > </p>
        > </form>
        >
        > hope this helped
        >
        > - JP
        >[/color]

        Thanks JP - I will try this!! Your help really is appreciated!

        again, thanks,

        Steve


        Comment

        • Steve

          #5
          Re: further on my fairly simple logic problem

          Thanks also to you Pedro - your help is invaluable to my ongoing efforts!

          Steve!



          "Pedro Graca" <hexkid@hotpop. com> wrote in message
          news:2h6tgpF9ds sbU1@uni-berlin.de...[color=blue]
          > Steve wrote:
          > (snip)[color=green]
          > > when I try to do a (obviously botched?!) cut and paste job to get the
          > > following:[/color]
          >
          > Where is the initial php tag?
          > The one that refers to the last "?>" you posted?
          >[color=green]
          > > <form name="form1" method="post" action="finalte st.php?stevetes t=",
          > > urlencode($item 1),' stevetest2=', urlencode($item 2),'">
          > > <p>
          > >
          > > <input type="text" name="textfield ">
          > > </p>
          > > <p>
          > > <input type="submit" name="submit"[/color][/color]
          value="Submit">[color=blue][color=green]
          > > </p>
          > > </form>?>
          > >
          > > I get a 'Parse error: parse error, unexpected '<''[/color]
          >
          > Where?
          >[color=green]
          > > Anyone able to help me mastering this last piece of my jigsaw?[/color]
          >
          > Try this:
          >
          > <?php
          > echo '<form name="form1" method="post" action="finalte st.php?';
          > echo 'stevetest=', urlencode($item 1), '&';
          > echo 'stevetest2=', urlencode($item 2), '">';
          > echo '<p><input type="text" name="textfield "></p>';
          > echo '<p><input type="submit" name="submit" value="Submit"> </p>';
          > echo '</form>';
          > ?>
          >
          > Or, as another poster said, separate the HTML from the PHP.
          >
          > --
          > 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 :[/color]


          Comment

          Working...