Jump to content

Help with this code please


john_in_Parrish

Recommended Posts

Hi everyone,  I am very green to php and I am trying to create code that will allow me to enter information to a database I constructed.  Everytime I run it though I get an object not found error 404.  I have searched google and have found some information however I am unable to correct my error,  Any help would be greatly appreciated.

 

John, 

Here is ithe code

 

<html>
<head>
</head>
<body>
<form action = 'insertform.php' method='post'>
Maker:<input type="text" name="maker"><br /><br />
Contact:<input type="text" name="contact"><br /><br />
Location:<input type="text" name="location"><br /><br />
Phone:<input type="int" name="phone"><br /><br />
<input type="submit" name="submit">
</form>
</body>
</html>



<?php
if (isset($_POST['submit'])){


$con = mysql_connect("localhost","root","");
if(!$con){
die("Cannot Connect: " . mysql_error());
}
mysql_select_db("ListParts2",$con);

$sql = "INSERT INTO Manufacturer (Maker,Contact,Location,Phone) VALUES ('$_POST[maker]','$_POST[contact]','$_POST[location]','$_POST[phone]')";

mysql_query($sql,$con);

mysql_close($con);
}
?>
Link to comment
https://forums.phpfreaks.com/topic/284559-help-with-this-code-please/
Share on other sites

 

Everytime I run it though I get an object not found error 404.

That error is coming from your web server. 404 errors usually means you have requested for a file but the server couldn't find it.

 

When the form is submitted the file that is requested is called insertform.php. Do you have this file spelled correctly? and is it in the same path as the html form?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.