Jump to content

Posting Form information to Database with PHP


Go to solution Solved by 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']

 

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.