Hi all,..
Need help for my script, i want to make update form for my database so i make script as follows
update.php
<form id="form1" name="Update" method="post" action="add.php">
<table border="0" cellspacing="10">
<tr>
<td>Asm Manual Id:</td> <td><input type="text" name="id"></td>
</tr>
<tr>
<td>Asm Manual name:</td> <td><input type="text" name="sheetname"></td>
</tr>
<tr>
<td>Image URL(Link):</td> <td><input type="text" name="link"></td>
</tr>
<tr>
<td><INPUT TYPE="Submit" VALUE="Update Asm Manual" NAME="Submit"></td>
</tr>
</table>
add.php
<?php
$con = mysql_connect("localhost", "sigit_p", "h4ngg401");
if (!$con)
{
die('Could not connect to DB: ' . mysql_error() );
}
mysql_select_db ("kdplnseries", $con);
$sql="INSERT INTO asmmanual (id, sheetname, link)
VALUES ('$_POST[id]','$_POST[sheetname]','$_POST[link]')";
if (!mysql_query($sql,$con))
{
die ('Error: ' . mysql_error());
}
echo "Record added";
//showing database record
$result = mysql_query("SELECT * FROM asmmanual")
or die(mysql_error());
$fields_num = mysql_num_fields($result);
echo "<table border='0'><tr>";
for($i=0; $i<$fields_num; $i++)
{
$field = mysql_fetch_field($result);
echo "<td>{$field->name}</td>";
}
echo "</tr>\n";
while($row = mysql_fetch_row($result))
{
echo "<tr>";
foreach($row as $cell)
echo "<td>$cell</td>";
echo "</tr>\n";
}
mysql_free_result($result);
mysql_close($con)
?>
what i want as follows : ,..
input type and stored text in database setting uppercase
for upload image file there is browse button after we chooses the file and automatically stored to specific folder in server (in database colomn contain link to image stored folder exp http://localhost/image/test.png).
thanks