Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-19-2006, 06:38 PM   PM User | #1
evesham
New Coder

 
Join Date: Jun 2006
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
evesham is an unknown quantity at this point
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
evesham is offline   Reply With Quote
Old 06-19-2006, 07:21 PM   PM User | #2
rlemon
Senior Coder

 
Join Date: Apr 2005
Posts: 1,051
Thanks: 0
Thanked 0 Times in 0 Posts
rlemon is on a distinguished road
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 ---<
rlemon is offline   Reply With Quote
Old 06-19-2006, 07:25 PM   PM User | #3
lavinpj1
Regular Coder

 
Join Date: Sep 2005
Posts: 394
Thanks: 1
Thanked 0 Times in 0 Posts
lavinpj1 is an unknown quantity at this point
or, as a point of interest, = e.g.

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

~Phil~
lavinpj1 is offline   Reply With Quote
Old 06-19-2006, 07:30 PM   PM User | #4
evesham
New Coder

 
Join Date: Jun 2006
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
evesham is an unknown quantity at this point
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!
evesham is offline   Reply With Quote
Old 06-19-2006, 07:54 PM   PM User | #5
rlemon
Senior Coder

 
Join Date: Apr 2005
Posts: 1,051
Thanks: 0
Thanked 0 Times in 0 Posts
rlemon is on a distinguished road
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 ---<
rlemon is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:17 AM.


Advertisement
Log in to turn off these ads.