haris244808 Posted July 22, 2011 Share Posted July 22, 2011 Here is a html form: i need help from someone to send me the database creation code and the php code needed to add this html form in DB... (ex: You put this html form in your website than Someone writes his name, surname chooses his city and uploads multiply pictures and they should be stored in DB) <body> <table border="0"> <form method ="post" action=""> <tr><td>Name</td><td><input type="text" name="name" size="40"></td></tr> <tr><td>Surname</td><td><input type="text" name="surname" size=40></td></tr> <tr><td>Email</td><td><input type="text" name="email" size="40"></td></tr> <tr><td>Tel. Nr</td><td><input type="text" name="number" size="40"></td></tr> <tr><td>Adress</td><td><input type="text" name="address" size="40"></td></tr> <tr><td>City</td><td><select name="city" size="1"> <option selected>A <option>B <option>C <option>D <option>E <option>F <option>G </select></td></tr> <tr><td>Info</td><td><textarea name="comment" rows =10 cols=40>write here...</textarea></td></tr> <tr><td>Upload </td> <td align="right"><input type="hidden" name="MAX_FILE_SIZE" value="500" > <input type="file" name="upload" size=30></td></tr> <tr><td></td><td align="right"> <br/><input type="submit" name="Dergo"> </form> </td></tr> </table> </body> Thanks Quote Link to comment https://forums.phpfreaks.com/topic/242618-help-for-the-picture-and-form-upload-in-db/ Share on other sites More sharing options...
gristoi Posted July 22, 2011 Share Posted July 22, 2011 People are here to help you with problems that you may have WITH CODE THAT YOU HAVE TRIED TO WRITE YOURSELF. If you want someone to write it for you from scratch then you need to post this in the freelance section and expect to pay for the work. Other wise you will more than likely be out of luck. Quote Link to comment https://forums.phpfreaks.com/topic/242618-help-for-the-picture-and-form-upload-in-db/#findComment-1246099 Share on other sites More sharing options...
haris244808 Posted July 22, 2011 Author Share Posted July 22, 2011 i have tried so many codes and didn't achieve what i want because i that i posted maybe someone have a ready one and can send. however thank you for the reply. i placed this topic where u suggested Quote Link to comment https://forums.phpfreaks.com/topic/242618-help-for-the-picture-and-form-upload-in-db/#findComment-1246110 Share on other sites More sharing options...
haris244808 Posted July 22, 2011 Author Share Posted July 22, 2011 Ok here i want to upload a picture in database: but it doesnt work where is the problem? here is my PHPcode: <?php $dbname="database_web"; $host="localhost"; $user=""; $pass=""; $link = mysql_connect($host, $user, $pass); mysql_select_db($dbname, $link); ?> <form method="post" enctype="multipart/form-data"> <table width="350" border="0" cellpadding="1" cellspacing="1" class="box"> <tr> <td width="246"> <input type="hidden" name="MAX_FILE_SIZE" value="2000000"> <input name="userfile" type="file" id="userfile"> </td> <td width="80"><input name="upload" type="submit" class="box" id="upload" value=" Upload "></td> </tr> </table> </form> <?php if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; $fp = fopen($tmpName, 'r'); $content = fread($fp, filesize($tmpName)); $content = addslashes($content); fclose($fp); if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); } $query = "INSERT INTO upload (name, size, type, content ) ". "VALUES ('$fileName', '$fileSize', '$fileType', '$content')"; mysql_query($query) or die('Error, query failed'); echo "<br>File $fileName uploaded<br>"; } ?> and here is my SQL code: CREATE TABLE upload ( id INT NOT NULL AUTO_INCREMENT, name VARCHAR(30) NOT NULL, type VARCHAR(30) NOT NULL, size INT NOT NULL, content MEDIUMBLOB NOT NULL, PRIMARY KEY(id) ); Quote Link to comment https://forums.phpfreaks.com/topic/242618-help-for-the-picture-and-form-upload-in-db/#findComment-1246146 Share on other sites More sharing options...
haris244808 Posted July 22, 2011 Author Share Posted July 22, 2011 ok i made it thanks Quote Link to comment https://forums.phpfreaks.com/topic/242618-help-for-the-picture-and-form-upload-in-db/#findComment-1246164 Share on other sites More sharing options...
fenway Posted July 22, 2011 Share Posted July 22, 2011 You're new here -- use code tags, and post the solution, not just "i made it". Quote Link to comment https://forums.phpfreaks.com/topic/242618-help-for-the-picture-and-form-upload-in-db/#findComment-1246255 Share on other sites More sharing options...
haris244808 Posted July 22, 2011 Author Share Posted July 22, 2011 no one helped man so i dont need to share Quote Link to comment https://forums.phpfreaks.com/topic/242618-help-for-the-picture-and-form-upload-in-db/#findComment-1246296 Share on other sites More sharing options...
fenway Posted July 22, 2011 Share Posted July 22, 2011 no one helped man so i dont need to share Wait a minute - you expect the rest of us to share, but you aren't willing to do so? Quote Link to comment https://forums.phpfreaks.com/topic/242618-help-for-the-picture-and-form-upload-in-db/#findComment-1246336 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.