Can't get Images/Text to upload to Database | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can't get Images/Text to upload to Database

How do I connect these to my database (local host). Iv'e tried many youtube videos but not joy. This is my coding without the database connection which is what I'm struggling with. <!DOCTYPE html> <html> <head> <title>Plane Crazy</title> </head> <body> <center> <h1>Upload Image</h1> <form action="" method="POST" enctype="multipart/form-data"> <label>Select Image</label><br> <input type="file" name="image" id="image"/><br> <label>Enter Aircraft</label><br> <input type="text" name="aircraft" placeholder="Enter Aircraft"/><br> <label>Enter Airline</label><br> <input type="text" name="airline" placeholder="Enter Airline"/><br> <label>Enter Reg</label><br> <input type="text" name="reg" placeholder="Enter Reg"/><br> <label>Enter Airport</label><br> <input type="text" name="airport" placeholder="Enter Airport"/><br> <input type="submit" name="upload" value="upload image" /><br> </form> </center> </body> </html>>

13th Apr 2023, 8:07 PM
Anthony
2 Answers
+ 6
TBH it's hard to tell what's wrong when the problem isn't clearly described. "Can't get images/text to upload to database" apparently doesn't signify anything specific. I recommend you save that snippet as new code bit, then attach the code bit link in post Description. You'd have more room to explain the situation in Description after removing the raw text snippet. With more information available, hopefully someone here can assist you through this. Don't forget to also tag the languages/tools used in your project, it helps everyone to isolate the issue and come up with relevant suggestions.
13th Apr 2023, 8:22 PM
Ipang
+ 2
First of all, you should understand how a html form works. When you submit the form, the action is triggered. This typically redirects to a back-end script, for example a PHP page, where you can read and process the data from the form (all the input fields). Without knowing more about your back-end and type of database, that's all I can say. Some more pages for you to read: https://www.w3schools.com/html/html_forms_attributes.asp https://www.w3schools.com/php/php_forms.asp https://www.w3schools.com/php/php_mysql_intro.asp
14th Apr 2023, 6:26 AM
Tibor Santa
Tibor Santa - avatar