English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have database called "blogs" with three fields: blog_title, blog_author, and blog_body.

I am working on the section of my webpage where users will be able to alter existing blogs. When the user opens the edit_blog.php page, I want a textbox to be displayed, and, inside the textbox, I'd like the information stored in blog_body to be printed.

How should I do this? I'm having trouble combining the HTML and PHP.

Specific code examples would be appreciated!

2007-02-16 08:52:11 · 5 answers · asked by Anonymous in Computers & Internet Programming & Design

5 answers

Lets suppose that $strValue contains the value which you want to show in text field. You can do this like:



In case of textarea, you can do this

2007-02-17 20:37:38 · answer #1 · answered by Atif Majid 3 · 0 1

Text Box Php

2016-12-10 19:28:56 · answer #2 · answered by ? 4 · 0 0

To keep this answer relatively short and simple, I'm going to ignore error checking and assume you've already got a database connection...

$blog_author = mysql_real_escape_string('Joe Smith');
$query = "
 SELECT * FROM blogs
 WHERE blog_author = '$blog_author'
";
$result = mysql_query($query);
$data = mysql_fetch_assoc($result);


Then, in your form, do something like this...


2007-02-16 09:14:58 · answer #3 · answered by Anonymous · 0 0

For future reference, these links in addition to php.net already mentioned may be helpful:

http://www.php-mysql-tutorial.com/
http://www.freewebmasterhelp.com/tutorials/phpmysql
http://www.webmonkey.com/programming/php/tutorials/tutorial4.html
http://www.phpfreaks.com/

A good book for reference is Web Database Application with PHP & MySQL from O'Reilly

2007-02-16 09:39:13 · answer #4 · answered by Anonymous · 0 0

This is not something for a newb to be doing, it is quite involved.

First create you connection to the DB:

$link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')
or die('Could not connect: ' . mysql_error());
echo 'Connected successfully';
mysql_select_db('my_database') or die('Could not select database');

next query your data:
$query = 'SELECT * FROM my_table';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());

now fill in your HTML
set the value="$result[index][name]

If you need more help hit me up on my blog at utahcon.efx2.com

2007-02-16 08:56:04 · answer #5 · answered by dragen_gto 3 · 0 0

fedest.com, questions and answers