Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Jesse Thompson
2,115 PointsTrying to integrate form.php file with phplist.hosted database.
Hi, so I have this template http://themetica.com/view.php?theme=choco
and on the second page I need to set up the form so when people input their email they subscribe to my newsletter.
This is the "form.php" file that hes included:
<?php
// CONFIGURATION
$host = "host"; // DAtabase address
$username = "username"; // Databse username
$password = "password"; // Database password
$database = "dbname"; // Database name
$connect = @mysql_connect($host, $username, $password) or die (@mysql_error());
$selectdb = @mysql_select_db($database, $connect) or die (@mysql_error());
// DATABSE INSERT
if(isset($_POST))
{
$email = $_POST['email'];
if (empty($email)) {
$status = false;
}else{
@mysql_query("INSERT INTO newsletter SET email='$email'"); // dont forget to change table name if you'll use another table name.
$status = true;
}
echo $status;
}
?>
I want to integrate that with my phplist.hosted database so people can input their email and automatically be added to the list.
If I need to make the database on my website that is fine too Im just a little unsure about the process.
1 Answer
Faizal Heesyam
8,843 Pointsi don't understand what you're looking for here.. when people fill up the Newsletter Subscription form, and submit, you want that email to be injected into two different table which is on a separate database? perhaps a clearer process flow might help.. :)