Re: Please help..



Thanks Rik. That helps me a lot.

Frank


Rik wrote:
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

.



Relevant Pages

  • Re: Please help..
    ... 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 ...
    (comp.lang.php)
  • Re: Upload file having Browse button and Submit button on same form
    ... What I do for form validation is I call the same page for display, validation and database entries. ... In the action part of the html form I use: ...
    (comp.lang.php)
  • Problem Passing File Names
    ... I'm using the following function to display a list of files in a ... directory in a HTML form that allows the user to delete files. ... field of the input tag gets passed through POST as ... must be doing something to my string. ...
    (comp.lang.php)
  • Repost: Merging external data with html (not dotnet) form
    ... My ASP.Net app needs to display a filled in form to a web ... read HTML form files (not ascx) dynamically from disk (e.g. ...
    (microsoft.public.dotnet.framework.aspnet)