SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2003
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help pass variable from form

    In the following piece of code I display the value of a variable called $name1. I then try to pass this variable in a form using input type= hidden
    However if the name was say Sam Jones, input type=hidden will only pass Sam. It doesnt seem to be able to pass anything after a space. Is there a way to overcome this proplem?

    PHP Code:
    <form action="success.php" method="post">
     
    <?php
    $name1 
    $row['name'];
    <
    tr><td>Section:&nbsp;<?php echo"$name1"  ?></td></tr>
     
    <tr><td><input type=hidden name=stands value= <?php echo"$name1?> ></td></tr>

  2. #2
    SitePoint Wizard
    Join Date
    Oct 2001
    Posts
    2,686
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need quotes around the values value in your html I think.
    Try
    PHP Code:
    <input type=hidden name=stands value="<?php echo $name1 ?>">
    And you don't need quotes around the variable in the echo.

    Hope this works

    -Helge

    Edit: Removed some lines that vB added in PHP tags
    Last edited by Helge; Feb 27, 2003 at 02:34.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2003
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes that works. Thanks.


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
  •