Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Forms and Databases.

New Here ,
Mar 24, 2009 Mar 24, 2009
Is it possible to send the form information to an email recipient and add to a database at the same time? I am PHP and MySQL.

Thanks,

Bob
TOPICS
Server side applications
475
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 24, 2009 Mar 24, 2009
BWSC wrote:
> Is it possible to send the form information to an email recipient and add to a database at the same time? I am PHP and MySQL.

Yes, but Dreamweaver won't do it automatically for you. Use the Insert
Record server behavior to insert the form information into the database.
Then switch to Code view and locate the following line ($connAdmin is
the name of your MySQL connection, so it is likely to be different):

$Result1 = mysql_query($insertSQL, $connAdmin) or die(mysql_error());

Immediately after that line, add a conditional statement like this:

if ($Result1) {
// insert email script here
}

Put your mail processing script inside the conditional statement.

--
David Powers
Adobe Community Expert, Dreamweaver
http://foundationphp.com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 25, 2009 Mar 25, 2009
Do you mean to put this;

if (($_POST['sender_name'] == "") ||
($_POST['sender_email'] == "") ||
($_POST['message'] == "")) {
header("Location: http://contact.html");
exit;
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 25, 2009 Mar 25, 2009
LATEST
BWSC wrote:
> Do you mean to put this;
>
> if (($_POST['sender_name'] == "") ||
> ($_POST['sender_email'] == "") ||
> ($_POST['message'] == "")) {
> header("Location: http://contact.html");
> exit;

No, I mean that's where you insert your mail processing script.

--
David Powers
Adobe Community Expert, Dreamweaver
http://foundationphp.com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines