Jump to content

Posting Form information to Database with PHP


deadendstreet

Recommended Posts

Hello,

 

I'm trying to post this form information to a database I created. However, when I hit submit, it takes me to the right page, but the page is blank. I go check the database and nothing has posted. I'm not getting an error message or anything. Thoughts?

<form name="Add" id="Add" method="post" action="programadd.php">
  <p>Program Name: 
    <input name="program" type="text" id="program" />
</p>
  <p>Air Date 
    <input name="air date" type="text" id="airdate" />
</p>
  <p>Description 
    <input name="description" type="text" id="description"  />
</p>
<p>Production
    <input name="production" type="text" id="production" />
</p>
<p>Promotions
    <input name="promotion" type="text" id="promotion"  />
</p>
<p>Community
    <input name="community" type="text" id="community" />
</p>
<p>Web
    <input name="web" type="text" id="web"  />
</p>
  <p>
    <input type="submit" name="Submit" value="Submit" />
</p>

Here's the program add page

 

<?php require_once("db_connx.php");
$program = $_POST['Program'];
$air_date = $_POST['Air_Date'];
$description =  $_POST['Description'];
$production = $_POST['Production'];
$promotion = $_POST['Promotions'];
$community = $_POST['Community'];
$web = $_POST['Web'];




f (mysql_query ("INSERT INTO Content_Calendar(Program, `Air_Date`, Description, Production, Community, Promotion, Web) VALUES 
('$program', '$air_date', '$description','$production', '$promotion', '$community', '$web')"))
{ echo "Program successfully added to the database <br />"; 
 }
else {
die(mysql_error());
}
require_once("db_connx_close.php");
?>

 

Also note that your form fields are named differently from your POST variables. For example, here the field is named "program"

<input name="program" type="text" id="program" />

And the POST variable is named "Program"

$_POST['Program']

 

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.