Solved

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

Posted on 2008-06-11
6
175 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

617 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