I have a code for adding information on the site
post page

<?php
if (isset($_POST['photo'])) {$photo = $_POST['photo']; if ($photo == ''){unset($photo);}}
if (isset($_POST['id_photo'])) {$id_photo = $_POST['id_photo']; if ($id_photo == ''){unset($id_photo);}}
$cat = $_GET['cat'];?>  
<script type="text/javascript">
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
</script>

  
<script src='style/jquery.js' type="text/javascript"></script>
<script src='style/documentation.js' type="text/javascript"></script>
<script src='style/jquery.form.js' type="text/javascript" language="javascript"></script>
<script src='style/jquery.MetaData.js' type="text/javascript" language="javascript"></script>
<script src='style/jquery.MultiFile.js' type="text/javascript" language="javascript"></script>
<script src='style/jquery.blockUI.js' type="text/javascript" language="javascript"></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<script type="text/javascript">
      <!-- Begin
      /* This script and many more are available free online at
        The JavaScript Source!! http://javascript.internet.com
         Created by: Abraham Joffe :: http://www.abrahamjoffe.com.au/ */
      /***** CUSTOMIZE THESE VARIABLES *****/
      // width to resize large images to
      var maxWidth=500;
      // height to resize large images to
      var maxHeight=500;
      // valid file types
      var fileTypes=["bmp","gif","png","jpg","jpeg"];
      // the id of the preview image tag
      var outImage="previewField";
      // what to display when the image is not valid
      var defaultPic="spacer.gif";
      /***** DO NOT EDIT BELOW *****/
      function preview(what){
      var source=what.value;
      var ext=source.substring(source.lastIndexOf(".")+1,source.length).toLowerCase();
     for (var i=0; i<fileTypes.length; i++){
      if (fileTypes[i]==ext){
      break;
      }
      }
      globalPic=new Image();
        if (i<fileTypes.length){  
     //Obtenemos los datos de la imagen de firefox
      try{
    globalPic.src=what.files[0].getAsDataURL();
      }catch(err){
        globalPic.src=source;
      }
       }else {
       globalPic.src=defaultPic;
       alert("Format error:nn"+fileTypes.join(", "));
      }
      setTimeout("applyChanges()",200);
      }
      var globalPic;
       function applyChanges(){
      var field=document.getElementById(outImage);
      var x=parseInt(globalPic.width);
      var y=parseInt(globalPic.height);
      if (x>maxWidth) {
      y*=maxWidth/x;
      x=maxWidth;
      }
      if (y>maxHeight) {
      x*=maxHeight/y;
      y=maxHeight;
      }
      field.style.display=(x<1 || y<1)?"none":"";
      field.src=globalPic.src;
      field.width=x;
      field.height=y;
      }
      // End -->
      </script>
<form name='form1' method='post' action='index.php?page=5&cat=<? echo $cat; ?>' enctype='multipart/form-data'>
<table border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
    <td class="body_bg_modul5"></td>
  </tr>
<tr><td class="body_bg_modul4">
<table border="0" cellspacing="0" cellpadding="0" align="center">
    <tr>
   <tr>
    <td align="center">
    <?php
    
   	if($cat ==true)
	{
		echo  "Tara : ".$cat ;
	}
   else
   {
	echo"Selecteaza  Tara";   
	}
	?><p>
<form name="form" id="form">
      Tara :
      <select name="jumpMenu" id="jumpMenu" onChange="MM_jumpMenu('parent',this,0)">
        <option value="../?">Select</option>
        <option value="../?page=4&cat=moldova">Moldova</option>
        <option value="../?page=4&cat=romania">Romania</option>
      </select>
    </form></p></td>
  </tr>
  <tr>
  <td align="center">

        <div align="center" style="line-height: 1.9em;">
      <br>
<input type="file" id="picField" class="multi"  name="pictures[]" maxlength="3"  onchange="preview(this)"/>
  <br>
      <img alt="Graphic will preview here" id="previewField" src="../style/No_imge.jpg">
      </div>



</td>
  </tr>
    <td align="center"><br>
    Tipul de imobil : 
    <select name="type">
    <option>Select</option>
        <option value="Apartamente" id="apartament">Apartamente</option>
        <option value="Case" id="Case">Case</option>
        <option value="Pamint" id="Pamint">Pamint</option>
        <option value="Oficiu" id="Oficiu">Oficiu</option>
      </select>
    </select>
     Regiunea : 
   <select name="regiunea"> 
   <?php
    if($cat==moldova)
	{echo '
    <option value="Chisinau">Chisinau</option>
	<option value="Ialoveni">Ialoveni</option>
	<option value="Balti">Balti</option>
	<option value="Orhei">Orhei</option>
	<option value="Cahul">Cahul</option>
	<option value="Ungheni">Ungheni</option>
	<option value="Soroca">Soroca</option>
	<option value="Hincesti">Hincesti</option>
	<option value="Edinet">Edinet</option>
	<option value="Tiraspol">Tiraspol</option>
	<option value="Tighina">Tighina</option>
	<option value="Comrat">Comrat</option>
	';}
	else
	{echo "";}
	
	if($cat==romania)
	{echo '
    <option value="3">Bucuresti</option>
	<option value="4">iasi</option>
	<option value="5">buzau</option>
	<option value="6">suceava</option>
	<option value="7">timisoara</option>
	<option value="8">Soroca</option>
	<option value="9">Hincesti</option>
	<option value="10">Edinet</option>
	<option value="11">Tiraspol</option>
	<option value="12">Tighina</option>
	<option value="13">Comrat</option>
	';
	}
	else
	{echo "";}
		?>
    
    </select>
    </td>
  </tr>
  <tr>
    <td><br>Pret : <input type="text" name="price">&nbsp;&nbsp;
    <select name='val'>
    <option>Select</option>
    <option value='&euro;'>&euro;</option>
    <option value='$'>$</option>
    <option value='MDL'>MDL</option>
    <option value='RON'>RON</option>
    </select>
    <br><input type="text" name="m_2">m&sup2;</td>
  </tr>
    <tr>
    <td align="center"><p>Messaj</p>
    <p><textarea name="message" cols="70" rows="10" wrap="physical"></textarea></p></td>
  </tr>
  <tr>
    <td align="center"><input type="submit" name="submite" value="Add"></td>
  </tr>
    </tr>
</table>  
</td></tr>
  <tr>
  <td class="body_bg_modul6"></td>
  </tr></table>
</form>

add page

<?php
$idi = $_COOKIE['idi'];
$result = mysql_query("SELECT * FROM userlist WHERE id='$idi' ",$conect);
$myrow = mysql_fetch_array($result);
$post_user = $myrow['username'] ;
    $length  =    6;
    $conso=array("b","c","d","f","g","h","j","k","l",
    "m","n","p","r","s","t","v","w","x","y","z");
	$num=array("1","2","3","4","5","6","7","8","9","0");
    $vocal=array("a","e","i","o","u");
    srand ((double)microtime()*1000000);
    $max = $length/2;
    for($i=1; $i<=$max; $i++)
    {
    $r.=$conso[rand(0,20)];
    $r.=$vocal[rand(0,10)];
	$r.=$num[rand(0,20)];
    }
      $tname = $_FILES["pictures"]["tmp_name"];
      $name = $_FILES["pictures"]["name"];
      foreach($tname as $key => $value)
      {
	       $plugin1 = "<a class='highslide imgbord' onclick='return hs.expand(this, config1 )' href='";
           $plugin2 = "'><img src='";
           $plugin3 = "' height='100' width='100' border='0'></a>";
           $images =  $r.$_FILES["pictures"]["name"]["$key"];
		   
		    move_uploaded_file($_FILES["pictures"]["tmp_name"]["$key"],"foto/".$r.$_FILES["pictures"]["name"]["$key"]) or die("Problems with upload");
	  
      }
if (isset($_GET['cat'])) {$cat = $_GET['cat'];}
if (isset($_POST['type'])) {$type = $_POST['type']; if ($type == ''){unset($type);}}
if (isset($_POST['m_2'])) {$m_2 = $_POST['m_2']; if ($m_2 == ''){unset($m_2);}}
if (isset($_POST['regiunea'])) {$regiunea = $_POST['regiunea']; if ($regiunea == ''){unset($regiunea);}}
if (isset($_POST['price'])) {$price = $_POST['price']; if ($price == ''){unset($price);}}
if (isset($_POST['val'])) {$val = $_POST['val']; if ($val == ''){unset($val);}}
if (isset($_POST['message'])) {$message = $_POST['message']; if ($message == ''){unset($message);}}
if (isset($_POST['post_user'])) {$post_user = $_POST['post_user']; if ($post_user == ''){unset($post_user);}}
if (
isset($type)
&&isset($m_2)
&&isset($regiunea)
&&isset($price)
&&isset($val)
&&isset($message)
&&isset($images)
&&isset($post_user)
){
$result = mysql_query ("INSERT INTO $cat
(
type,m_2,regiunea,price,val,message,images,post_user
)
VALUES 
(
'$type','$m_2','$regiunea','$price','$val','$message','$images','$post_user'
)");
}

if ($result == 'true') {echo '<br>
<table border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
    <td class="body_bg_modul5"></td>
  </tr>
<tr><td class="body_bg_modul4">
<table border="0" cellspacing="0" cellpadding="0" align="center">
    <tr>
   <tr>
    <td align="center">
	<p>Sa adaugat!</p>
	</td></tr>
  <tr>
  <td class="body_bg_modul6"></td>
  </tr></table>

	
	
	';}
	
else {echo '<br>
<table border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td class="body_bg_modul5"></td></tr>
<tr><td class="body_bg_modul4">

<table border="0" cellspacing="0" cellpadding="0" align="center">
    <tr>
   <tr>
    <td align="center">
	<p>Nu sa adaugat!</p>
	</td></tr></table>
<tr>
<td class="body_bg_modul6"></td></tr>
</table>

	
	
	';}

?>

When i add the information , from 3 chosen photos is adding just the latest one
how can i make the code to add all 3 photos

I don't see where the photo form field is being generated (I just see code at top where you test it.)

If photo is a checkbox set or a multi-select, name the form field as 'photo[]'; <select name="photo[]" multiple="multiple" ...> [ You can then treat $_POST as an array.


Just some advice, for quicker responses, include more commentary on what your code is intending to do. Gotta be REALLY bored (like I am right now) to go pouring through 300 lines of code without even knowing what you are trying to do. Also, many of your form fields are in a language not all of us are familiar with, which is fine, but a bit of translation helps.

I beg your pardon ,i don't now very goo englesh ,
Me problem is theat this script allow you to upload 3 photos

<form name='form1' method='post' action='upload.php' enctype='multipart/form-data'>
<input type="file" id="picField" class="multi"  name="pictures[]" maxlength="3"  onchange="preview(this)"/>
 <br>
      <img alt="Graphic will preview here" id="previewField" src="../style/No_imge.jpg">
      </div>
      <input type="submit" name="submite" value="Add">

but i have problems with adding information in database
It is adding 1 photo in 1 tabel, but i need to add all 3 photos in 1 tabel

<?php
      $tname = $_FILES["pictures"]["tmp_name"];
      foreach($tname as $key => $value)
      {
      move_uploaded_file($_FILES["pictures"]["tmp_name"]["$key"],"upload/".$r.$_FILES["pictures"]["name"]["$key"]) or die("Problems with upload");

$pictures =  $r.$_FILES["pictures"]["name"]["$key"];
$conect = mysql_connect("localhost","root","")or die("Error");
mysql_select_db("test")or die("Error");
$result = mysql_query ("INSERT INTO test (pictures) VALUES ('$pictures')");
if ($result == 'true')
 {echo 'Succes!';}
else 
 {echo 'Error!';}
}
?>

Try this:

echo "<pre>".print_r($_FILES,true)."</pre>";  die("stopping to debug");
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.