Solved

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

Posted on 2008-06-11
6
168 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:RQuadling
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
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 
LVL 40

Expert Comment

by:RQuadling
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:RQuadling
RQuadling 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

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
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.

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now