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
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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.