Click to See Complete Forum and Search --> : how to set up file value


franknu
04-16-2007, 10:58 AM
What is the best way to do this. I am not getting any display here...


echo"<input name=\"Picture1\" type=\"file\" value=\"".$row['Picture1']."\" >";

it is

tca
04-16-2007, 11:57 AM
value cannot be used with type="file".

Try outputting your image as a thumbnail under your input field.

TC

franknu
04-16-2007, 01:41 PM
my problem is that i want people to update the pictures and if the values doent show it meant that they will have to uodate pictures every time that they make changes to the pages here is my code



IF ($moved1=true and $moved2=true and $moved3=true and $moved4=true and $moved5=true and $moved6=true) :

$query="UPDATE business_info SET BusinessName= ('$_POST[BusinessName]'), `Slogan`=('$_POST[Slogan]'),
Business_Address = ('$_POST[Business_Address]'), Tel=('$_POST[Tel]'), Website= ('$_POST[Website]'),
Email = ('$_POST[Email]'), Fax= ('$_POST[Fax]'), `type`='$type',
make = '$make', Categories = ('$_POST[Categories]'), Keyword = ('$_POST[Keyword]'), `Picture1` = '$fullpath1',
Headline = ('$_POST[Headline]'), Slogan2 = ('$_POST[Slogan2]'), Description1 = ('$_POST[Description1]'),
Description2 = ('$_POST[Description2]'), Description3 = ('$_POST[Description3]'),
`Picture2` = '$fullpath2', `Picture3` = '$fullpath3',
`Picture4` = '$fullpath4', `Picture5` = '$fullpath5',
`Picture6` = '$fullpath6',
`Password`= '$Password' WHERE User_Name = '$User_Name'";


$result = mysql_query($query) or die ("Problem with the query: <pre>$query</pre><br>" . mysql_error());




ENDIF;
ENDIF;

tca
04-16-2007, 05:06 PM
You're going to have to restructure your query. How are the pictures uploaded? Use your upload script to update the record. Use an array for your pictures then if the array is empty (no one changed a picture) nothing happens and the query isn't executed. If only one is changed, then only the one that is changed is updated in the database record.


echo"<input name=\"Picture[]\" type=\"file\" />";


Then in your upload script:


if(is_array($_FILES['Picture'])){

//upload the image(s)

//update the record

}

//if $_FILES['Picture'] was not an array then nothing happens