Jump to content

PHP Form to send email & store in mysql


karthikn7974

Recommended Posts

Hi all,

 

I am having the below code.

Filename : insertform.php

 
<html><head><title>Birthdays Insert Form</title></head>
<body>
<table width="300" cellpadding="5" cellspacing="0" border="2">
<tr align="center" valign="top">
<td align="left" colspan="1" rowspan="1" bgcolor="64b1ff">
<h3>Insert Record</h3>
<form method="POST" action="db_insert_record.php">
<input type="hidden" name="username" value="<? print $_POST['username']?>">
<input type="hidden" name="password" value="<?print $_POST['password']?>">
<?
print "Enter Name: <input type=text name=name size=20><br>\n";
print "Enter Birthday: <input type=text name=birthday size=10><br>\n";
print "<br>\n";
print "<input type=submit value=Submit><input type=reset>\n";
?>
</form>
</td></tr></table>
</body>
</html>

 

Filename : db_insert_record.php

<html><head><title>Birthdays Insert Record</title></head>
<body>
<?
$name=$_POST['Name'];
$birthday=$_POST['birthday'];
$db="mydatabase";
$link = mysql_connect("localhost");
//$link = mysql_connect("localhost",$_POST['username'],$_POST['password']);
if (! $link)
die("Couldn't connect to MySQL");
mysql_select_db($db , $link) or die("Select Error: ".mysql_error());
$result=mysql_query("INSERT INTO birthdays (name, birthday) VALUES ('$name','$birthday')")or die("Insert Error: ".mysql_error());
mysql_close($link);
print "Record added\n";
?>
<form method="POST" action="birthdays_insert_form.php">
<input type="submit" value="Insert Another Record">
</form>
</body>
</html>

 

the above code stores in db.

I need help on how to send email at the same time while writing to mysql.

 

do i need to use multiple POST ?

 

Kindly help me or suggest for all possible methods

 

thanks with anticipation

 

Link to comment
https://forums.phpfreaks.com/topic/119776-php-form-to-send-email-store-in-mysql/
Share on other sites

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.