php - how to save and retrive my images from mysql -


i using php mysql.

i want create form different fields.

the form in html looking this.

<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> <script type="text/javascript"> var categories = []; categories["startlist"] = ["rental","sale"] categories["rental"] = ["residential","commercial"]; categories["sale"] = ["commercial","residential"]; categories["residential"] = ["flot","independent"]; categories["commercial"] = ["play & plug","baseshare"]; categories["biography"] = ["play & plug","bareshare"]; categories["fiction"] = ["flot","independent"]; var nlists = 3; // number of select lists in set  function fillselect(currcat,currlist){ var step = number(currlist.name.replace(/\d/g,"")); (i=step; i<nlists+1; i++) { document.forms['tripleplay']['list'+i].length = 1; document.forms['tripleplay']['list'+i].selectedindex = 0; } var ncat = categories[currcat]; (each in ncat) { var noption = document.createelement('option');  var ndata = document.createtextnode(ncat[each]);  noption.setattribute('value',ncat[each]);  noption.appendchild(ndata);  currlist.appendchild(noption);  }  }    function init() {  fillselect('startlist',document.forms['tripleplay']['list1']) }  navigator.appname == "microsoft internet explorer" ? attachevent('onload', init,     false) : addeventlistener('load', init, false); function mm_validateform() { //v4.0   if (document.getelementbyid){     var i,p,q,nm,test,num,min,max,errors='',args=mm_validateform.arguments;     (i=0; i<(args.length-2); i+=3) { test=args[i+2];     val=document.getelementbyid(args[i]);       if (val) { nm=val.name; if ((val=val.value)!="") {         if (test.indexof('isemail')!=-1) { p=val.indexof('@');           if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain e-mail     address.\n';         } else if (test!='r') { num = parsefloat(val);           if (isnan(val)) errors+='- '+nm+' must contain number.\n';           if (test.indexof('inrange') != -1) { p=test.indexof(':');             min=test.substring(8,p); max=test.substring(p+1);             if (num<min || max<num) errors+='- '+nm+' must contain number between     '+min+' , '+max+'.\n';       } } } else if (test.charat(0) == 'r') errors += '- '+nm+' required.\n'; }      } if (errors) alert('the following error(s) occurred:\n'+errors);     document.mm_returnvalue = (errors == ''); } } </script>   </head>  <body>      <table width="60%"><form action="process.php" method="post"     enctype="multipart/form-data" name="tripleplay"     onsubmit="mm_validateform('fullname','','r','area','','r','ownermobile','','risnum','email'    ,'','risemail','otherdetail','','r');return document.mm_returnvalue">        <tr>     <td width="44%">full name : </td>     <td width="56%"><input size="25" type="text" name="fullname" id="fullname" /></td>   </tr>   <tr>     <td valign="top">rental type:</td>       <td>      <select name='list1' id="list1"     onchange="fillselect(this.value,this.form['list2'])"> <option selected>make selection</option> </select> <br /><br /> <select name='list2' id="list2" onchange="fillselect(this.value,this.form['list3'])">   <option selected>make selection</option> </select><br /><br /> <select name='list3' id="list3" onchange="getvalue(this.value,     this.form['list2'].value,  this.form['list1'].value)">   <option selected>make selection</option> </select>  </td>   </tr>   <tr>     <td>area : </td>     <td><input size="25" type="text" name="area" id="area" />       sq.ft.</td>   </tr>   <tr>     <td>owner mobile / landline</td>     <td><input size="25" type="text" name="ownermobile" id="ownermobile" /></td>   </tr>   <tr>     <td><p>e-mail</p></td>     <td><input size="25" type="text" name="email" id="email" /></td>   </tr>   <tr>     <td valign="top">pictures of property</td>     <td>        <input type="file" name="image_one" id="image_one" />           <input type="file" name="image_two" id="image_two" />           <input type="file" name="image_three" id="image_three" />     </td>   </tr>     <tr>     <td valign="top">other details share property:</td>      <td><textarea size="25" name="otherdetail" id="otherdetail" cols="45" rows="5">    </textarea></td>   </tr>   <tr>     <td>&nbsp;</td>     <td><input type="submit" name="submit" id="submit" value="submit" /></td>   </tr> </form> </table> </body> </html> 

and form processing file looking this.

<? if( $_post ) {   $con =     mysql_connect("","","");    if (!$con)   {     die('could not connect: ' . mysql_error());   }    mysql_select_db("vkrental", $con);    $users_fullname = $_post['fullname'];   $users_area = $_post['area'];   $users_list1 = $_post['list1'];   $users_list2 = $_post['list2'];   $users_list3 = $_post['list3'];   $users_ownermobile = $_post['ownermobile'];   $users_email = $_post['email'];   $users_image_one = $_post['image_one'];   $users_image_two = $_post['image_two'];   $users_image_three = $_post['image_three'];   $users_otherdetail = $_post['otherdetail'];     $users_fullname = htmlspecialchars($users_fullname);   $users_area = htmlspecialchars($users_area);   $users_list1 = htmlspecialchars($users_list1);   $users_list2 = htmlspecialchars($users_list2);   $users_list3 = htmlspecialchars($users_list3);    $users_ownermobile = htmlspecialchars($users_ownermobile);   $users_email = htmlspecialchars($users_email);   $users_image_one = htmlspecialchars($users_image_one);   $users_image_two = htmlspecialchars($users_image_two);   $users_image_three = htmlspecialchars($users_image_three);   $users_otherdetail = htmlspecialchars($users_otherdetail);       $query = "    insert `vkrental`.`owner_detail` (  `fullname` , `area` , `list1` , `list2` , `list3` ,   `ownermobile` , `email` , `image_one` , `image_two` , `image_three` , `otherdetail` ) values ( '$users_fullname',     '$users_area', '$users_list1','$users_list2','$users_list3', '$users_ownermobile', '$users_email', '$users_image_one','$users_image_two','$users_image_three', '$users_otherdetail'         );";    mysql_query($query);    echo "<h2>.</h2>";    mysql_close($con); }  ?> 

and mysql table looking

create table `owner_detail` (   `id` int(10) not null auto_increment,   `fullname` varchar(30) not null,   `list1` varchar(20) not null,   `list2` varchar(20) not null,   `list3` varchar(20) not null,   `area` varchar(30) not null,   `ownermobile` varchar(20) not null,   `email` varchar(20) not null,   `image_one` blob not null,   `image_two` blob not null,    `image_three` blob not null,   `otherdetail` varchar(300) not null,   primary key  (`id`) ) engine=myisam  default charset=utf8 auto_increment=24 ; 

my problem 1) on mysql table image show's [blob - 0 b], need show image on phpmyadmin web browser? 2) on phpmyadmin(localhost) show's underline whenever cursor going on, not in web host. why ?

any great full.


Comments