I need to create a form about companies with couple of information (as you can see down below), but every time I want to upload a new row I get 1's in every column.
So, I want to know what should I do with my code?
<?php
include('mysql.php');
if ($_POST) {
$companyName = isset($_POST['cname']);
$address = isset($_POST['address']);
$phoneNubmber = isset($_POST['phoneNubmber']);
$result = $connection->query("INSERT INTO `companies`
(`name`, `email`, `phone`) VALUES('$cegnev ',
'$address', '$pn')");
header('Location: http://localhost/phptest/test.php');
mysqli_close($connection);
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Form</title>
<meta charset="UTF-8">
<link rel="stylesheet" tpe="text/css" href="urlapcss.css">
</head>
<body>
<div id="container">
<form id="reg" action="test.php" method="post">
<fieldset>
<legend>Form</legend>
<ol>
<li>
<label for="cname">Name of the company<em>*</em></label>
<input id="cname" type="text" name="cname"/>
</li><li>
<label for="address">Email<em>*</em></label>
<input id="address" type="text" name="address"/>
</li><li>
<label for="phoneNubmber">Phone number<em>*</em></label>
<input id="phoneNubmber" type="text" name="phoneNubmber" />
</li>
</ol>
</fieldset>
<input type="submit" value="OK"/>
</form>
</div>
</body>
</html>
Btw, the mysql.php, if you wondering what this .php file contains :
<?php
$host = "localhost";
$userName = "root";
$password = "";
$DBname = "hgeza06";
$connection = new mysqli($host, $userName, $password, $DBname);
if ($connection->connect_error) {
die("Error");
} else {
echo "Succes!";
}
?>