SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Thread: short question

  1. #1
    SitePoint Zealot Blunderboy's Avatar
    Join Date
    Mar 2003
    Location
    Germany
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    short question

    Is there an easier/quicker way to insert those <br>s?

    <?php
    echo $_POST["Choice1"];
    echo ("<br>");
    echo $_POST["Choice2"];
    echo ("<br>");
    echo $_POST["Choice3"];
    ?>

  2. #2
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <?php
    $text 
    $_POST['Choice1'].'
    '
    .$_POST['Choice2'].'
    '
    .$_POST['Choice3'];

    echo 
    nl2br($text);
    ?>
    That should do It I think...
    Last edited by Sketch; Aug 12, 2003 at 07:13.
    Aaron Brazell
    Technosailor



  3. #3
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ...or...
    PHP Code:
    for($i=1;$i<4;$i++)
      {
      
    $choice='Choice'.$i;
      echo 
    $_POST[$choice].'<br />';
      }
    ?> 
    Aaron Brazell
    Technosailor



  4. #4
    SitePoint Zealot Blunderboy's Avatar
    Join Date
    Mar 2003
    Location
    Germany
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh thanks, I'll give them a try. I like the look of the second one.

  5. #5
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oops, first one was missing an apostrophe. Corrected. The 2nd one is prolly the quickest, most efficient way...
    Aaron Brazell
    Technosailor



  6. #6
    SitePoint Zealot Blunderboy's Avatar
    Join Date
    Mar 2003
    Location
    Germany
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Sketch
    oops, first one was missing an apostrophe. Corrected. The 2nd one is prolly the quickest, most efficient way...
    Yes they both work well. Thanx again.

  7. #7
    SitePoint Zealot Blunderboy's Avatar
    Join Date
    Mar 2003
    Location
    Germany
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    echo "Price Range:" . $_GET[Price];

    I thought I had to put Price in quotes but it works without as well. Anything wrong with doing that?

  8. #8
    SitePoint Enthusiast falfool's Avatar
    Join Date
    Jun 2003
    Location
    Amman
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how come does it work? it didnt use to work with me... lol

  9. #9
    SitePoint Enthusiast
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi,
    this can be done with a oneliner
    PHP Code:
    foreach(range(1,4) as $i) print $_POST['Choice'.$i].'<br>'
    have fun!
    Last edited by algis; Aug 14, 2003 at 22:00.


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
  •