the code saves the category, image title, image, and feature..
but the problem is that the "feature" is not saved, but the others were saved..
this is the data types of my table
category = text
title = text
image = longblob
feature = text
in html, the users input the feature in (textarea)..
is there a problem with the code? pls.. help
[code=php]
<?php
// Connect to database
$errmsg = "";
if (! @mysql_connect( "localhost","ro ot","")) {
$errmsg = "Cannot connect to database";
}
@mysql_select_d b("upload");
// Insert any new image into database
if ($_REQUEST[completed] == 1) {
// Need to add - check for large upload. Otherwise the code
// will just duplicate old file ;-)
// ALSO - note that latest.img must be public write and in a
// live appliaction should be in another (safe!) directory.
move_uploaded_f ile($_FILES['imagefile']['tmp_name'],"latest.img ");
$instr = fopen("latest.i mg","rb");
$image = addslashes(frea d($instr,filesi ze("latest.img" )));
if (strlen($instr) < 149000) {
mysql_query ("insert into sharp (category, title, imgdata, feature) values (\"". $_REQUEST[categ] . "\", \"". $_REQUEST[whatsit] . "\", \"". $image . "\", \"". $feature . "\")");
} else {
$errmsg = "Too large!";
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitl ed Document</title>
<link href="div.css" rel="stylesheet " type="text/css" />
</head>
<body>
<style type="text/css">
body
{
background-image: url(body.jpg);
background-repeat: no-repeat;
background-position: top left;
}
</style>
<h3 align = "left">Plea se upload a new picture and title</h3>
<form method=post>
<table border = "0" align = "left">
<tr>
<td>Brand:</td>
<td><select name = "brand">
<option>SONY</option>
<option>SHARP </option>
<option>LG</option>
<option>PANASON IC</option>
<option>SAMSUNG </option>
<option>JVC</option></select></td>
</tr>
<tr>
<td>Category: </td>
<td><select name = "categ">
<option>TV</option>
<option>AUDIO </option>
<option>WASHI NG MACHINE</option>
<option>REFRIGE RATOR</option>
<option>AIR CONDITIONER</option>
<option>MICROWA VE OVEN</option></select></td>
</tr>
<tr>
<td>Image Title:</td>
<td><input name=whatsit></td>
</tr>
<tr>
<input type=hidden name=MAX_FILE_S IZE value=150000>
<input type=hidden name=completed value=1>
<td>Upload Image:</td>
<td><input type=file name=imagefile> </td>
</tr>
<tr>
<td>Feature:</td>
<td><textarea name = "feature"></textarea></td>
</tr>
<tr>
<td></td>
<td><input type=submit value = "Save"></td>
</tr>
</table>
<br>
</form><br>
</body>
</html>
[/code]
but the problem is that the "feature" is not saved, but the others were saved..
this is the data types of my table
category = text
title = text
image = longblob
feature = text
in html, the users input the feature in (textarea)..
is there a problem with the code? pls.. help
[code=php]
<?php
// Connect to database
$errmsg = "";
if (! @mysql_connect( "localhost","ro ot","")) {
$errmsg = "Cannot connect to database";
}
@mysql_select_d b("upload");
// Insert any new image into database
if ($_REQUEST[completed] == 1) {
// Need to add - check for large upload. Otherwise the code
// will just duplicate old file ;-)
// ALSO - note that latest.img must be public write and in a
// live appliaction should be in another (safe!) directory.
move_uploaded_f ile($_FILES['imagefile']['tmp_name'],"latest.img ");
$instr = fopen("latest.i mg","rb");
$image = addslashes(frea d($instr,filesi ze("latest.img" )));
if (strlen($instr) < 149000) {
mysql_query ("insert into sharp (category, title, imgdata, feature) values (\"". $_REQUEST[categ] . "\", \"". $_REQUEST[whatsit] . "\", \"". $image . "\", \"". $feature . "\")");
} else {
$errmsg = "Too large!";
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitl ed Document</title>
<link href="div.css" rel="stylesheet " type="text/css" />
</head>
<body>
<style type="text/css">
body
{
background-image: url(body.jpg);
background-repeat: no-repeat;
background-position: top left;
}
</style>
<h3 align = "left">Plea se upload a new picture and title</h3>
<form method=post>
<table border = "0" align = "left">
<tr>
<td>Brand:</td>
<td><select name = "brand">
<option>SONY</option>
<option>SHARP </option>
<option>LG</option>
<option>PANASON IC</option>
<option>SAMSUNG </option>
<option>JVC</option></select></td>
</tr>
<tr>
<td>Category: </td>
<td><select name = "categ">
<option>TV</option>
<option>AUDIO </option>
<option>WASHI NG MACHINE</option>
<option>REFRIGE RATOR</option>
<option>AIR CONDITIONER</option>
<option>MICROWA VE OVEN</option></select></td>
</tr>
<tr>
<td>Image Title:</td>
<td><input name=whatsit></td>
</tr>
<tr>
<input type=hidden name=MAX_FILE_S IZE value=150000>
<input type=hidden name=completed value=1>
<td>Upload Image:</td>
<td><input type=file name=imagefile> </td>
</tr>
<tr>
<td>Feature:</td>
<td><textarea name = "feature"></textarea></td>
</tr>
<tr>
<td></td>
<td><input type=submit value = "Save"></td>
</tr>
</table>
<br>
</form><br>
</body>
</html>
[/code]
Comment