Jump to content


Photo

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


  • Please log in to reply
3 replies to this topic

#1 cecilieuk

cecilieuk
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 05 July 2006 - 09:35 PM

Hello!

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 = "cecilieuk@yahoo.com";
$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[i]];
if (obj){
switch(obj.type){
case "select-one":
if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
alertMsg += " - " + fieldDescription[i] + "\n";
}
break;
case "select-multiple":
if (obj.selectedIndex == -1){
alertMsg += " - " + fieldDescription[i] + "\n";
}
break;
case "text":
case "textarea":
if (obj.value == "" || obj.value == null){
alertMsg += " - " + fieldDescription[i] + "\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[i] + "\n";
}
}
}
}

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

~Cecilie

#2 birdie

birdie
  • Members
  • PipPipPip
  • Advanced Member
  • 65 posts
  • LocationBirmingham UK

Posted 05 July 2006 - 09:51 PM

Do you host your own files?
is the php.ini data correct?
Are you allowed to mail?

Hope these questions help  ;D

#3 cecilieuk

cecilieuk
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 07 July 2006 - 08:02 PM

I don't need more questions....  :P

what's the php.ini?...

Do you know another way to enter information in a form,click submit-button, retrieve information from form on previous page, and email this information...

Am I completely on the wrong track?..

#4 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 07 July 2006 - 08:15 PM


$to = 'bob@barnyard.com';
$subject = 'Wakeup bob!';
$message = '<b>yo</b>, whassup?';
$headers = "From: server@barnyard.com\r\n" .
      'X-Mailer: PHP/' . phpversion() . "\r\n" .
      "MIME-Version: 1.0\r\n" .
      "Content-Type: text/html; charset=utf-8\r\n" .
      "Content-Transfer-Encoding: 8bit\r\n\r\n";

// Send
mail($to, $subject, $message, $headers);
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users