You are here: Re: Please help.. « PHP Programming Language « IT news, forums, messages
Re: Please help..

Posted by Rik on 07/16/06 12:14

fjm67 wrote:
> If someone can either direct me to some howto or even provide me with
> an example, I would be grateful.
>
> I would like to know if it is possible to create an HTML form text box
> that can draw information out of the database and display it in the
> HTML form text box. I have purchased a few books on the integration of
> databases and PHP but can find no such example. Maybe there is a
> better
>
> way of doing this?
>
> My theory is that if I can draw this information from the database and
> have it displayed in the HTML form text box, this same information can
> be UPDATED if need be from the same page. Any information or a point
> in


- Assuming a table tbl_name, with fields id & text
- Displaying and updating all records at once
- Simpified code, without error checking and hence a major security risk:

<form action="<?php echo $_SERVER['PHP_SELF']; ?> method="post">
<?php
$con = mysql_connect('host', 'user', 'pass');
mysql_select_db('db',$con);
if(isset($_POST['submit'])){
foreach($_POST['text'] as $id => $text){
mysql_query("UPDATE tbl_name SET `text` = '{$text}' WHERE `id` =
$id");
}
}
$result=mysql_query("SELECT id,text FROM tbl_name");
while($row = mysql_fetch_array($result)){
echo '<textarea
name="text['.$row['id'].']">'.$row['text'].'</textarea>';
}
?>
<input type="submit" name="submit" value="change" />
</form>

If you have purchased some books I assums they will tell you what to do
about safety...

Grtz,
--
Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация