jeliot Posted April 2, 2006 Share Posted April 2, 2006 I want to add a statement to print "Your Email Has Been Submitted" into my email form but I'm having trouble ANY SUGGESTIONSThanks Link to comment https://forums.phpfreaks.com/topic/6408-email-submitted-script/ Share on other sites More sharing options...
play_ Posted April 2, 2006 Share Posted April 2, 2006 post the code yo. Link to comment https://forums.phpfreaks.com/topic/6408-email-submitted-script/#findComment-23212 Share on other sites More sharing options...
jeliot Posted April 2, 2006 Author Share Posted April 2, 2006 [!--quoteo(post=360950:date=Apr 2 2006, 02:20 PM:name=play_)--][div class=\'quotetop\']QUOTE(play_ @ Apr 2 2006, 02:20 PM) [snapback]360950[/snapback][/div][div class=\'quotemain\'][!--quotec--]post the code yo.[/quote]<?php$db_host = "mysql";$db_user = "jeliot";$db_pwd = "8013301";$db_name = "email";mysql_connect($db_host, $db_user, $db_pwd);mysql_select_db($db_name);if (!isset($_POST['submit'])) {?><img src="images/email_list_logo.jpg" width="500" height="204"><form action="" method="post">Name: <input type="text" name="name" size="50"><br>Email: <input type="text" name="email" size="50"><br><input type="submit" name="submit" value="Submit!"></form><?php} else {$name = $_POST['name'];$email = $_POST['email'];$query = "INSERT INTO email_list (name,email) VALUES ('".$name."','".$email."')";$result = mysql_query($query) or die(mysql_error()); // this performs the actual query.}?>sorry .............brain fart..............I'm still working on cleaner less complicated script but every time I mess with it.......it either won't display or won't populate the db with any dataalso is there a way to get this form to open in a new smaller browser window with a php script or do I have to implement java code Link to comment https://forums.phpfreaks.com/topic/6408-email-submitted-script/#findComment-23239 Share on other sites More sharing options...
alpine Posted April 2, 2006 Share Posted April 2, 2006 [code] {$name = $_POST['name'];$email = $_POST['email'];$query = "INSERT INTO email_list (name,email) VALUES ('".$name."','".$email."')";$result = mysql_query($query) or die(mysql_error()); // this performs the actual query.// start visualif($result){print "This is a message displayed upon query success!";}else{print "This is a message displayed due to insert failure";}// end visual}[/code] Link to comment https://forums.phpfreaks.com/topic/6408-email-submitted-script/#findComment-23242 Share on other sites More sharing options...
jeliot Posted April 2, 2006 Author Share Posted April 2, 2006 [!--quoteo(post=360981:date=Apr 2 2006, 04:37 PM:name=alpine)--][div class=\'quotetop\']QUOTE(alpine @ Apr 2 2006, 04:37 PM) [snapback]360981[/snapback][/div][div class=\'quotemain\'][!--quotec--][code] {$name = $_POST['name'];$email = $_POST['email'];$query = "INSERT INTO email_list (name,email) VALUES ('".$name."','".$email."')";$result = mysql_query($query) or die(mysql_error()); // this performs the actual query.// start visualif($result){print "This is a message displayed upon query success!";}else{print "This is a message displayed due to insert failure";}// end visual}[/code][/quote]Thanks that worked great............now I'll really test ya.....wink....winkhow about code that will read the data fields and display "You are already on the mailing List" if it finds the same data in the db Link to comment https://forums.phpfreaks.com/topic/6408-email-submitted-script/#findComment-23292 Share on other sites More sharing options...
play_ Posted April 3, 2006 Share Posted April 3, 2006 {$name = $_POST['name'];$email = $_POST['email'];$check = "SELECT * FROM email_list WHERE name='$name' and email='$email'";$check_result = mysql_query($check);$num = mysql_num_rows($check_result);if (num > 0) { echo "You are already on the mailing list";} else {$query = "INSERT INTO email_list (name,email) VALUES ('".$name."','".$email."')";$result = mysql_query($query) or die(mysql_error()); // this performs the actual query.// start visualif($result){print "This is a message displayed upon query success!";}else{print "This is a message displayed due to insert failure";}// end visual}} Link to comment https://forums.phpfreaks.com/topic/6408-email-submitted-script/#findComment-23336 Share on other sites More sharing options...
jeliot Posted April 3, 2006 Author Share Posted April 3, 2006 [!--quoteo(post=361075:date=Apr 2 2006, 09:29 PM:name=play_)--][div class=\'quotetop\']QUOTE(play_ @ Apr 2 2006, 09:29 PM) [snapback]361075[/snapback][/div][div class=\'quotemain\'][!--quotec--]{$name = $_POST['name'];$email = $_POST['email'];$check = "SELECT * FROM email_list WHERE name='$name' and email='$email'";$check_result = mysql_query($check);$num = mysql_num_rows($check_result);if (num > 0) { echo "You are already on the mailing list";} else {$query = "INSERT INTO email_list (name,email) VALUES ('".$name."','".$email."')";$result = mysql_query($query) or die(mysql_error()); // this performs the actual query.// start visualif($result){print "This is a message displayed upon query success!";}else{print "This is a message displayed due to insert failure";}// end visual}}[/quote]I gave the script a shot with a name and email already in the db and it went through successfully Thanks for the input i have a starting point atleast let me know if you find any thing i should try changing Link to comment https://forums.phpfreaks.com/topic/6408-email-submitted-script/#findComment-23345 Share on other sites More sharing options...
txmedic03 Posted April 3, 2006 Share Posted April 3, 2006 Never post your usernames/passwords to anything on a publicly viewable website. Link to comment https://forums.phpfreaks.com/topic/6408-email-submitted-script/#findComment-23401 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.