Solved

How to get action script to both post to email and post to table

Posted on 2008-06-11
6
173 Views
Last Modified: 2013-12-13
I am trying to create a php form with Dreamweaver MX that will post to a table and post  to an email address at the same time when the submit button is hit.  I can only get it to do one or the other but not both.  Any suggestions how to do both.
0
Comment
Question by:cfwd
  • 3
  • 2
6 Comments
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 21764409
If you have a form whose action is "mailto:someone@somewhere.com", then the browser is responsible for getting the local mail client started to be able to send the message, not the server.

What you need to look at is the mail() command in PHP.

http://docs.php.net/manual/en/function.mail.php


There first example ...

<?php
// The message
$message = "Line 1\nLine 2\nLine 3";

// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);

// Send
mail('caffinated@example.com', 'My Subject', $message);
?>
0
 
LVL 16

Accepted Solution

by:
rbudj earned 250 total points
ID: 21765288
This is correct.  The logic behind it is this.

First, take the data from the variables and send the message, then below the mail() command just echo the variables.
0
 

Author Comment

by:cfwd
ID: 21770915
I can get the mail function to work but I want it to work only when the form is submitted and to have the form post to my table at the same time.  Where do I put the mail code so that it works at the same time as posting to the table?  
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 40

Expert Comment

by:Richard Quadling
ID: 21773417
Where is the code for posting to the table?

Oh.

When you say "table" do you mean ...

<table>

or

INSERT INTO table(column [, ...]) VALUES(value [, ...])

?

I've assumed (possibly wrongly) you meant an SQL table rather than an HTML table.
0
 

Author Comment

by:cfwd
ID: 21775116
Yes, I meant MySQL table.  I want the sumit button to send the data to my database and to send an email notifying that the database has been updated.  Can anyone help? I don't know code.
0
 
LVL 40

Assisted Solution

by:Richard Quadling
Richard Quadling earned 250 total points
ID: 21777793
You must have some code if it currently sends to the MySQL table?

Ah. You've got neither working?

Take a look at http://docs.php.net/manual/en/mysql.examples.php to get some idea of how you talk to mysql.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question