PHP in Single line TextField
Moderator: General Moderators
PHP in Single line TextField
Is it possible to have a single line TextField that retrieves text using PHP from a Mysql database? I've managed to do it with a Multi line Textarea but the same code doesn't seem to work with a Single line TextField. It's necessary as the data to be retrieved is short and doesn't need the scroll bar that a Multi line TextField automatically wraps around it.
Thanks again
Leao
Thanks again
Leao
Code: Select all
<input type="text" name="sometextfield" value="<?php echo $data_from_database; ?>" />- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Remember to do an htmlentities() on that.. 
feyd | Please use
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi, I've attached the code I used for the Multi line text area and the code I tried for the Single line TextField that failed. Haven't I done already what you suggested?
thanx
leaoCode: Select all
<form method="post" action="meetthecommunity.php">
<div align="center">
<p>
<textarea name="meetthecommunity" cols="43" rows="14" id="meetthecommunity"><?php
mysql_connect("mysql","username","password") or die(mysql_error());
mysql_select_db("database_text") or die(mysql_error());
$result = mysql_query("SELECT * FROM grid")
or die(mysql_error());
$row = mysql_fetch_array( $result );
echo $row['meetthecommunity'];
?>
</textarea>
</p>
<p>
<input type="submit" value="upload text">
</p>
</div>
</form>Code: Select all
<form method="post" action="nnameamember1.php">
<div align="center">
<p>
<input name="nnameamember1" type="text" id="nnameamember1" value="<?phpmysql_connect("mysql","username","password") or die(mysql_error());mysql_select_db("database_text") or die(mysql_error()); $result = mysql_query("SELECT * FROM grid")or die(mysql_error()); $row = mysql_fetch_array( $result );echo $row['nnameamember1'];?>" size="20">
</p>
<p>
<input type="submit" value="change nickname">
</p>
</div>
</form>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]