I was able to learn enough to find out how to write to a mysql database using a basic html form. However, once the information has been written to the database, what is the next step to preview and update the information written in the database? I want to edit the information in the future. Can someone just write a little write up so I can get an idea and follow the syntax. Thanks.
p.s. View my code to see what I am doing.
[B]index.html
[code=php]<? $uploadNeed = 4; ?>
<table>
<form name=”form1″ enctype=”multipart/form-data” method=”post” action=”processfiles.php”>
<?
for($x=0;$x<$uploadNeed;$x++){
?>
<tr>
<td>Picture <? echo $x+1; ?> </td>
<td>
<input name=”uploadFile<? echo $x;?>” type=”file” id=”uploadFile<? echo $x;?>”> </td> </tr>
<?
// end of for loop
}
?>
<tr>
<td colspan=”3″ valign=”top” width=”100%”> <textarea cols=”80″ name=”desc”></textarea></td>
</tr>
<tr>
<td colspan=”2″>
<input name=”uploadNeed” type=”hidden” value=”<? echo $uploadNeed;?>”>
<input type=”submit” name=”Submit” value=”Submit”></td></tr>
</form>
</table>
[B]processfiles.php
[code=php]<?
include(“db.php”);
$uploadNeed = $_POST[‘uploadNeed’];
$desc=$_POST[‘desc’];
$files_list=array();
// start for loop
for($x=0;$x<$uploadNeed;$x++){
$file_name = $_FILES[‘uploadFile’. $x][‘name’];
// strip file_name of slashes
$file_name = stripslashes($file_name);
$file_name = str_replace(“‘”,””,$file_name);
$copy = copy($_FILES[‘uploadFile’. $x][‘tmp_name’],”uploads/”. $file_name);
// check if successfully copied
if($copy){
$files=array_push($files_list,$file_name);
}
else{
echo “$file_name | could not be uploaded!<br>”;
}
} // end of loop
$sqlinsert=”Insert into pics (Intro,Pics1,Pics2,Pics3,Pics4) VALUES (‘$desc’,’$files_list[0]’,’$files_list[1]’,’$files_list[2]’,’$files_list[3]’)”;
mysql_query($sqlinsert,$db);
echo mysql_error();
echo “Success!”;
?>