e-mail form-data to e-mail with php..?how?

2013-04-27  Source: Original Site  Category:PHP  Views:0 

Advertisement

I've got a simple form with 2 fields where user will enter name and e-mail..

*********************'
<form name="formcheck" method="post" action="test.php" onSubmit="return formCheck(this);">

<p align="center">&nbsp;</p>
<p align="center"> <font face="Americana BT">Navn</font>
<input type="text" name="FirstName">
</p>
<p align="center"><font face="Americana BT">E-mail</font>
<input type="text" name="email">
</p>
<p align="center">
<input name="Submit" type="submit" id="Submit" value="Ja takk, jeg vil motta nyhetsbrev per mail">
</p>
</form>
**********************

on the test.php page I've got the following php-code. But it will not work, as in I don't receive an e-mail... I've learned php on beginner level at uni 9 months ago, but haven't used it since..

**********************
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php

$firstname=$_POST['FirstName'];
$email=$_POST['email'];

$to = "[email protected]";
$re = "Purchase receipt";
$message = '$firstname'.','.'$email';

mail ($to, $re, $message);

?>
HELLO..
</body>
</html>
*******************************************

Will appreciate all help

ps: the onSubmit-action will not work either... it did work before I started messing around with php...
got the onSubmit-action from DynamicDrive.com

**********************************

<script language="JavaScript">
<!--

/***********************************************
* Required field(s) validation v1.10- By NavSurf
* Visit Nav Surf at http://navsurf.com
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

function formCheck(formobj){
// Enter name of mandatory fields
var fieldRequired = Array("FirstName", "email");
// Enter field description to appear in the dialog box
var fieldDescription = Array("Navn", "email");
// dialog message
var alertMsg = "Vennligst fyll inn manglende felt:\n";

var l_Msg = alertMsg.length;

for (var i = 0; i < fieldRequired.length; i++){
var obj = formobj.elements[fieldRequired];
if (obj){
switch(obj.type){
case "select-one":
if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
alertMsg += " - " + fieldDescription + "\n";
}
break;
case "select-multiple":
if (obj.selectedIndex == -1){
alertMsg += " - " + fieldDescription + "\n";
}
break;
case "text":
case "textarea":
if (obj.value == "" || obj.value == null){
alertMsg += " - " + fieldDescription + "\n";
}
break;
default:
}
if (obj.type == undefined){
var blnchecked = false;
for (var j = 0; j < obj.length; j++){
if (obj[j].checked){
blnchecked = true;
}
}
if (!blnchecked){
alertMsg += " - " + fieldDescription + "\n";
}
}
}
}

if (alertMsg.length == l_Msg){
return true;
}else{
alert(alertMsg);
return false;
}
}
// -->
</script>
******************************

~Cecilie

Related articles
  • E-mail form data quick and easily with PHP 2013-03-23

    Intro This is one of the fastest (and raw) ways to process form information from a web page. We assume that you have a form setup with Dreamweaver or a html editor. Getting started In the $_POST global variable the results of a submitted from are sto

  • e-mail form-data to e-mail with php..?how? 2013-04-27

    I've got a simple form with 2 fields where user will enter name and e-mail.. *********************' <form name="formcheck" method="post" action="test.php" onSubmit="return formCheck(this);"> <p align="center">&nbsp;</p> <p al

  • Which form atts can I use with PHP? 2015-01-10

    I am working on developing a form and I am wondering which form attributes I can use with PHP. I tried to use a multiple selection option as I will show below: What equipment do you currently own?<br /> <select name="equipment" size="4" mult

  • sending form data via e-mail? 2012-10-30

    imusing the following line of code <form action="mailto:[email protected]" action="post"> but it tells the user its goining via e-mail and also then presents them with there default e-mail utility how can i get it so it send it to me and they

  • PHP Mailing form data to user, and to me... 2013-10-14

    when my users register on my site, i want to send them a copy of the form data that they registered, and i want to have a copy go to me as well... can anyone show me how to do this???

  • mail function does not work correctly with PHP 4.3.2 2013-05-30

    I am a bit confused. I'm working to a PHP mail sender script, but i got in trouble with PHP 4.3.2 and Win2k. I discovered that my old script (working good with PHP 4.1.2 and Win NT4) after passing to Win 2k and PHP 4.3.2 seems not to connect to mail

  • Modifying data in address book with PHP and MySQL 2013-06-22

    I'm working off a tutorial on building an address book with mysql and php. For a reference you can find it here: http://php.about.com/od/finishedphp1/ss/address_book.htm I'm having no problems with creating the database in sql, I've entered some samp

  • Extracting data from html code with php 2014-06-16

    I'm pretty new with php, and I'm trying to figure out how I could make a script where html source code can be taken from a site, pasted into a textarea, and then have the form extract certain things from pasted code. For instance, how would you go ab

  • nclob-data from oracle 9 with php???? 2014-10-30

    I get following message, when reading nclob-data from an oracle 9.i-database with php: Warning: OCILobRead: ORA-24806: LOB form mismatch in .......... this message means: "When reading from or writing into LOBs, the character set form of the user buf

  • Picking up data from other sites with PHP 2015-02-14

    Im wondering if there is a PHP technology that will allow you to pick up data from third party sites serverside with PHP? Is this possible?

  • I've replaced .htm pages with .php how does this effect search engines 2014-04-15

    Hi, I've rewritten my web site replacing most of the .htm pages with .php pages How will this effect search engine records? How do I inform them pages have been removed and new pages have replaced them? How do I redirect non existent pages to the new

  • parsing form data into a mailer 2013-08-31

    I'm unsure about how I can send mail to multiple form inputs. I have a set up like this: http://eric.serverselect.net/form.html I want the users to be able to input a name and e-mail in each box, and have it mail to each e-mail put in, using a loop.

  • Small problem using php to mail form data 2012-12-11

    I finally have it so that when I click the submit button, I do get an email, but all that shows up is: "Name:". It doesn't tell me what the name is, or show the other two fields. (It does go to the Thank You page OK.) What am I doing wrong? Thanks in

  • Help E-mailing form data 2015-01-15

    I am trying to get a form to be processed and emailed to me. I am using "mailmepro" but it dosen't seem to be working? Hopefully someone with some knowledge may be able to help me.....? The HTML I am using looks like this: <html> <head>

  • Form data doesn't print with Netscape 2015-03-31

    I have a form with input fields that a user will fill in and then most likely want to print. When printing in Netscape (with the browser print button) the form prints but the input fields are blank! Any ideas on what I might be doing wrong???

  • sending form data via jquery AJAX to php script 2014-08-24

    I know how to send data from a form via action/method but I'm clueless as to how to send php variables from a form using jquery AJAX and get a callback echoing the response I'm looking at the visual jquery AJAX, but I don't know how to config the for

  • Insert new data into XML file with PHP 2013-06-08

    I have a customer XML file containing some basic customer information. I have a PHP form where I can input information for new customers. I want the information from the form to be posted into the customer XML file. How do I update my current custome

  • Date Field in MySQL with PHP /add/edit/delete 2012-03-14

    Hello Im makineg a small cms for my purposes and my problem is updating adding dhe DATE, im getting 00.00.0000 can anybody help me making a drop down date with dd/mm/YYYY so I can add - edit ?? Thnx a lot Enjoy Life

  • date sensitive website updates with php 2015-03-31

    i would like to prepare some updates for my website in advance and then to let them go online on a specific date. for example: gallery xyz update --> activate on 21 april story xyz update --> activate on 24 april and so on. so that i can prepar

  • how do i get form parameter on successful page with php? 2012-10-14

    hello i have a login form that contain <form action="login.php" method="post" name="logForm" id="logForm" > <input name="username" type="text" id="username" size="40" /> <input name="pwd" type="password" id="pwd" size="40" /> <in