deadendstreet Posted April 10, 2014 Share Posted April 10, 2014 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"); ?> Link to comment https://forums.phpfreaks.com/topic/287659-posting-form-information-to-database-with-php/ Share on other sites More sharing options...
trq Posted April 10, 2014 Share Posted April 10, 2014 You should get a syntax error, you are missing the 'i' in 'if'. Link to comment https://forums.phpfreaks.com/topic/287659-posting-form-information-to-database-with-php/#findComment-1475616 Share on other sites More sharing options...
cyberRobot Posted April 10, 2014 Share Posted April 10, 2014 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'] Link to comment https://forums.phpfreaks.com/topic/287659-posting-form-information-to-database-with-php/#findComment-1475668 Share on other sites More sharing options...
deadendstreet Posted April 10, 2014 Author Share Posted April 10, 2014 Yup, that worked. Thanks guys, I knew it would be something simple. Link to comment https://forums.phpfreaks.com/topic/287659-posting-form-information-to-database-with-php/#findComment-1475719 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.