Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jun 2006
    Posts
    13
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Adding a PHP Value to a Form

    Hello,

    I'd like to add a PHP value into the value field of a form which will then be sumitted to process via memberlist.php. The field is hidden. How do i add PHP code to a form as this doesn't currently work:

    Code:
    <FORM METHOD="POST" ACTION="memberlist.php">
    <table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><?php echo $row['username']; ?></td>
        <td><input type="text" name="userquery" value="'<?php $row['username']; ?>'"></td>
        <td><input type="submit" name="Submit" value="Submit"></td>
      </tr>
    </table>
    </form>
    The PHP/SQL code then loops around.

    Thanks

  • #2
    Senior Coder
    Join Date
    Apr 2005
    Posts
    1,051
    Thanks
    0
    Thanked 0 Times in 0 Posts
    to 'print' or 'echo' the code you need to call it out as that

    Code:
    <FORM METHOD="POST" ACTION="memberlist.php">
    <table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><?php echo $row['username']; ?></td>
        <td><input type="text" name="userquery" value="'<? print $row['username']; ?>'"></td>
        <td><input type="submit" name="Submit" value="Submit"></td>
      </tr>
    </table>
    </form>
    instead of print you can also use echo

    echo $row['username']
    public string ConjunctionJunction(string words, string phrases, string clauses)
    {
    return (String)(words + phrases + clauses);
    }
    <--- Was I Helpfull? Let me know ---<

  • #3
    Regular Coder
    Join Date
    Sep 2005
    Posts
    394
    Thanks
    1
    Thanked 0 Times in 0 Posts
    or, as a point of interest, = e.g.

    <?php= $row['username']; ?>

    ~Phil~

  • #4
    New Coder
    Join Date
    Jun 2006
    Posts
    13
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by rlemon
    to 'print' or 'echo' the code you need to call it out as that

    Code:
    <FORM METHOD="POST" ACTION="memberlist.php">
    <table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><?php echo $row['username']; ?></td>
        <td><input type="text" name="userquery" value="'<? print $row['username']; ?>'"></td>
        <td><input type="submit" name="Submit" value="Submit"></td>
      </tr>
    </table>
    </form>
    instead of print you can also use echo

    echo $row['username']
    Thanks, Great help both of you dudes!

  • #5
    Senior Coder
    Join Date
    Apr 2005
    Posts
    1,051
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by lavinpj1
    or, as a point of interest, = e.g.

    <?php= $row['username']; ?>

    ~Phil~
    didn't want to confuse him/her
    public string ConjunctionJunction(string words, string phrases, string clauses)
    {
    return (String)(words + phrases + clauses);
    }
    <--- Was I Helpfull? Let me know ---<


  •  

    Posting Permissions

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