Q1: I'm new to programming and have no idea what I'm doing wrong. I'm getting the following error:
Notice: Undefined index: pimage in [..]
this is the code:
<form method="post" enctype="multipart/form-data">
<label for="pimage">photo</label>
<input type="file" name="pimage" id="fileToUpload"/><br />
<input type="submit" name="psubmit" value="register" />
</form>
and this is my PHP:
if (isset($_POST['psubmit'])) {
$image = $_POST['pimage'];
Q2: After the above code the form should be placed in a database, I don't get any errors but I don't see anything appearing in the database. Here is the PHP code:
if (isset($_POST['psubmit'])) {
include 'opendb.php';
$stmt = $dbh->prepare("INSERT INTO new_products(Title, Price, CID,
Categorie, Sub-categorie, Description, Shipping) VALUES(:value1, :value2,
:value3, :value4, :value5, :value6, :value7)");
$image = $_POST['pimage'];
$values = array(
'value1' => $_POST['ptitle'],
'value2' => $_POST['pprice'],
'value3' => $_POST['pcid'],
'value4' => $_POST['pcat'],
'value5' => $_POST['psubcat'],
'value6' => $_POST['pdescription'],
'value7' => $_POST['pshipping'], );
$stmt->execute($values);
$stmt->errorInfo();
}
great that this question is marked as a duplicated, but I don't see the awnser in the given link. I know what I have to set $_POST['pimage'] and as far as I know I did. I don't want to be the person that you need to feed the information but please give me the text in the given link so this piece of code is done.