Hi Advanced Devs,
I am very new to php. This is my learning moment. So, Help me.
I have added a zip folder with my files. I also have expoted my database as zipped folder.

Please help me with this topics. Please.
Samrat

Recommended Answers

All 8 Replies

Member Avatar for rajarajan2017

I dont know how to extract your database file to the sql. But your problem seems to be simple, what is the problem you facing?

Member Avatar for rajarajan2017
$sql = "INSERT INTO productinput(name, address, phone, email)
VALUES('$brand', '$model', '$image', '$desc', '$price')";

The above query may be wrong, you passed five values to four fields.

There sir,
I have edited, but still is not working. You can import the table of db "own".
Just go to phpmyadmin. click on import. browse the own.sql.

Please help me.
Thanks buddy
sam

The name of Desription column causes the problem chached the name now it works.

productinput.php

<html>
<head>
<title>Product Input</title>
</head>
<body>
<form action="submit.php" method="post" enctype="multipart/form-data" name="form1">
  <table width="500" border="0" align="center">
    <tr>
      <td colspan="2">Input Your Product Details Here-</td>
    </tr>
    <tr>
      <td width="245">Brand</td>
      <td width="245"><label>
        <input type="text" name="brand" id="brand">
      </label></td>
    </tr>
    <tr>
      <td>Model</td>
      <td><label>
        <input type="text" name="model" id="model">
      </label></td>
    </tr>
    <tr>
      <td>Image</td>
      <td><label>
        <input type="file" name="image" id="image">
      </label></td>
    </tr>
    <tr>
      <td>Description</td>
      <td><label>
        <textarea name="descr" id="descr" cols="45" rows="5"></textarea>
      </label></td>
    </tr>
    <tr>
      <td>Price</td>
      <td><label>
        <input type="text" name="price" id="price">
      </label></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><label>
        <input type="submit" name="button" id="button" value="Submit">
      </label></td>
    </tr>
  </table>
</form>
</body>
</html>

cont.php

<html>
<head>
<title>Connection Page</title>
</head>
<body>
<?php
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("own") or die(mysql_error());
?>

</body>
</html>

submit.php

<html>
<head>
</head>
<body>
<?php
include('cont.php');

$brand = $_POST['brand'];
$model = $_POST['model'];
$image = ($_FILES['image']['image']);
$descr = $_POST['descr'];
$price = $_POST['price'];

$sql = "INSERT INTO productinput(brand, model, image, descr, price)
VALUES('$brand', '$model', '$image', '$descr', '$price')";
$result = mysql_query($sql);

if (!$result)
{
die (mysql_error());
}
else
{
echo "You have submitted information Successfully";
}
?>

</body>
</html>

hope this helps

Thanks Man, I am checking. If any help. I will disturb you again. Dont mind.

Notice: Undefined index: image in G:\wamp\www\own\submit.php on line 10
Unknown column 'descr' in 'field list'

change the field in your data base from "desc" to "descr"

many many thanks, A+ to you.

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.