loxinthe
January 2nd, 2008, 06:14
Ok I have this first file:
<?
$title=$_POST['title'];
$pic=$_POST['pic'];
$description=$_POST['description'];
$expire=$_POST['expire'];
$valid=$_POST['valid'];
mysql_connect(localhost,$uname,$pword) or die("It's gone");
@mysql_select_db($db) or die( "Unable to select database");
$query = "SELECT * FROM special WHERE title='$title',pic='$pic',description='$descriptio n',expire='$expire',valid='$valid'";
echo $pic;
?>
<form ENCTYPE="multipart/form-data" method="post" action="editdb.php">
<table bgcolor=#ffffcc align=center>
<tr>
<td colspan=2><strong>Fill out this form to edit this special on the web site</strong></td></tr>
<tr><td> Title:</td><td><input type="text" size=25 name="title" value="<?echo $title;?>"></td></tr>
<tr><td> Image:</td><td><input type="file" name="pic" value="<? echo $pic;?>"><input type="hidden" name="pico" value="<? echo $pic; ?>"></td></tr>
<tr><td>Description:</td><td><textarea height="30" name="description"><? echo $description; ?></textarea></td></tr>
<tr><td >Expiration:</td><td align=center>
<input type="text" size=25 name="expire" value="<?echo $expire;?>">
</td></tr>
<tr>
<td>
Valid with other offers?:</td>
<td>
<input type="radio" name="valid" value="yes" <? if ($valid=="yes"){echo "checked";} ?>> Yes<br>
<input type="radio" name="valid" value="no" <? if ($valid=="no"){echo "checked";} ?>> No
</td>
</tr>
<tr><td colspan=2 align=center><input type=submit name="send" value="Submit"></td></tr>
</table>
</form>
which should use this one to update:
<?
$uname="<<removed>>";
$pword="<<removed>>";
$db="<<removed>>";
if(strlen($_files['pic'])>0) {
$target = "specialsimages/";
$target = $target . basename(
$_FILES['pic']['name']) ;
echo "$target <br>";
$ok=1;
move_uploaded_file($_FILES['pic']['tmp_name'], $target)
$pic=$target;
}else{
$pic=$_POST['pico'];
}
$title=$_POST['title'] ;
$description=$_POST['description'];
$expire=$_POST['expire'];
$valid=$_POST['valid'];
mysql_connect(localhost,$uname,$pword) or die("It's gone");
@mysql_select_db($db) or die( "Unable to select database");
$query = "UPDATE special SET title = '$title', pic =
'$pic', description = '$description', expire = '$expire',
valid = '$valid'";
mysql_query($query);
mysql_close();
?>
All I get is: Parse error: syntax error, unexpected T_VARIABLE in /home/eyeaxcom/public_html/editdb.php on line 14
What is happening I can't figure it out.
<?
$title=$_POST['title'];
$pic=$_POST['pic'];
$description=$_POST['description'];
$expire=$_POST['expire'];
$valid=$_POST['valid'];
mysql_connect(localhost,$uname,$pword) or die("It's gone");
@mysql_select_db($db) or die( "Unable to select database");
$query = "SELECT * FROM special WHERE title='$title',pic='$pic',description='$descriptio n',expire='$expire',valid='$valid'";
echo $pic;
?>
<form ENCTYPE="multipart/form-data" method="post" action="editdb.php">
<table bgcolor=#ffffcc align=center>
<tr>
<td colspan=2><strong>Fill out this form to edit this special on the web site</strong></td></tr>
<tr><td> Title:</td><td><input type="text" size=25 name="title" value="<?echo $title;?>"></td></tr>
<tr><td> Image:</td><td><input type="file" name="pic" value="<? echo $pic;?>"><input type="hidden" name="pico" value="<? echo $pic; ?>"></td></tr>
<tr><td>Description:</td><td><textarea height="30" name="description"><? echo $description; ?></textarea></td></tr>
<tr><td >Expiration:</td><td align=center>
<input type="text" size=25 name="expire" value="<?echo $expire;?>">
</td></tr>
<tr>
<td>
Valid with other offers?:</td>
<td>
<input type="radio" name="valid" value="yes" <? if ($valid=="yes"){echo "checked";} ?>> Yes<br>
<input type="radio" name="valid" value="no" <? if ($valid=="no"){echo "checked";} ?>> No
</td>
</tr>
<tr><td colspan=2 align=center><input type=submit name="send" value="Submit"></td></tr>
</table>
</form>
which should use this one to update:
<?
$uname="<<removed>>";
$pword="<<removed>>";
$db="<<removed>>";
if(strlen($_files['pic'])>0) {
$target = "specialsimages/";
$target = $target . basename(
$_FILES['pic']['name']) ;
echo "$target <br>";
$ok=1;
move_uploaded_file($_FILES['pic']['tmp_name'], $target)
$pic=$target;
}else{
$pic=$_POST['pico'];
}
$title=$_POST['title'] ;
$description=$_POST['description'];
$expire=$_POST['expire'];
$valid=$_POST['valid'];
mysql_connect(localhost,$uname,$pword) or die("It's gone");
@mysql_select_db($db) or die( "Unable to select database");
$query = "UPDATE special SET title = '$title', pic =
'$pic', description = '$description', expire = '$expire',
valid = '$valid'";
mysql_query($query);
mysql_close();
?>
All I get is: Parse error: syntax error, unexpected T_VARIABLE in /home/eyeaxcom/public_html/editdb.php on line 14
What is happening I can't figure it out.