Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 178
  • Last Modified:

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

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
cfwd
Asked:
cfwd
  • 3
  • 2
2 Solutions
 
Richard QuadlingSenior Software DeverloperCommented:
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
 
rbudjCommented:
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
 
cfwdAuthor Commented:
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
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
Richard QuadlingSenior Software DeverloperCommented:
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
 
cfwdAuthor Commented:
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
 
Richard QuadlingSenior Software DeverloperCommented:
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now