Jump to content

help with a email from in php


tamirdvc

Recommended Posts

Hi

 

I have taken a ready php script and i have tryid to add one more field to it so it will also send me the name of the user that send me this email

but as i have add it now the script don't work any more and if it did work it didn't send me this new field i have add

i also need to do also a check that this field is with text and if it is without text then it need to give a popup as it do with all the rest so if you can help me fix this code it will help me a lot

 

thanks

 

Yours

 

Tamir

mail.zip

Link to comment
Share on other sites

All you did was add the name field to your form and then defined a php variable to store the name when the form is submitted. You have not modified the code that sends the email to also include the name.

 

This is this code that sends the email.

mail("tamir@tamirt.co.il", 'site email: '.$subject, $_SERVER['REMOTE_ADDR']."\n\n".$message "From: $from");

Where do you want the name to displayed in the email, before the message or after the message?

 

 

 

 

also how can i change it so that the email i get will be written from right to left as in Hebrew and not from left to right ?

For that you either need to set the charset or send a html email.

Edited by Ch0cu3r
Link to comment
Share on other sites

hi

i need to name to be in the start of the email aka:

 

name: "the name that the user has enetr"

 

and all the text need to be from right to left

so if you can send me what is the part of the code that i need to change so it will give me the name and also the right to left it will help me a lot.

Link to comment
Share on other sites

also i have fix the code a bit but now i have seen that i have a problme with the line of the email

as if this line is empty the from still send it i only get a message if the user didn't enter a @

this is the code

 

so what to i need to add to make it also test if this field is empty

 

 

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1255" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>צור קשר</title>
<script type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' כתובת מייל לא חוקית.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += ' '+nm+' חסר\n'; }
  } if (errors) alert('זוהו השגיאות הבאות\n'+errors);
  document.MM_returnValue = (errors == '');
}
//-->
</script>
<style type="text/css">
.text {
    -moz-border-radius: 5px;
 -webkit-border-radius: 5px;
 border-radius: 5px;
 behavior: url(border-radius.htc);
}
</style>

</head>

<body style="color: #42B2AC; background-color: #000000">

<form action="mailer.php" method="post" name="form1" id="form1" style="margin:0px; font-family:Helvetica, Arial, sans-serif;font-size:20px; width:215px;" onsubmit="MM_validateForm('from','','RisEmail','subject','','R','verif_box','','R','message','','R');return document.MM_returnValue" dir="rtl" style="float: right;">
        שם:<br />
<input name="name" type="text" class="text" id="name" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:16px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:14px;" value="<?php echo $_GET['name'];?>"/>

 מייל:<br />
<input name="from" type="text" class="text" id="from" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:16px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:14px;" value="<?php echo $_GET['from'];?>" dir="ltr"/>

<br />
 נושא:<br />
<input name="subject" type="text" class="text" id="subject" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:16px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px;" value="<?php echo $_GET['subject'];?>"/>

<br />

 כתוב את המספר שבתמונה:<br />
<input name="verif_box" type="text" class="text" id="verif_box" style="padding:2px; border:1px solid #CCCCCC; width:140px; height:16px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px;"/>
<img src="verificationimage.php?<?php echo rand(0,9999);?>" class="text" alt="verification image, type it in the box" width="50" height="21" align="absbottom" /><br />

<!-- if the variable "wrong_code" is sent from previous page then display the error field -->
<?php if(isset($_GET['wrong_code'])){?>
<div style="border:1px solid #990000; background-color:#D70000; color:#FFFFFF; padding:1px; padding-left:1px;width:155px;" class="text">
 הקוד שהוזן אינו נכון</div>
<?php ;}?>

 המכתב:
<textarea name="message" class="text" cols="6" rows="5" id="message" style="padding:2px; border:1px solid #CCCCCC; width:200px; height:100px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px;"><?php echo $_GET['message'];?></textarea>

<input name="Submit" class="text" type="submit" style="margin-top:10px; display: block; border:2px solid #CCCCCC; width:100px; height:32px; font-family:Verdana, Arial, Helvetica, sans-serif; color: white ;font-size:20px; padding-left:2px; padding-right:2px; padding-top:0px; padding-bottom:2px; line-height:10px; background-color:#EA0071;" value="שלח מכתב"/>
</form>

Link to comment
Share on other sites

Hi

 

can i also get your help how to add check that the name field is not empty

it need to be in this line so the jave check will work but i can't get it to work

 

<form action="mailer.php" method="post" name="form1" id="form1" style="margin:0px; font-family:Helvetica, Arial, sans-serif;font-size:20px; width:215px;" onsubmit="MM_validateForm('from','','RisEmail','subject','','R','verif_box','','R','message','','R');return document.MM_returnValue" dir="rtl" style="float: right;">

 

and also how do i make the email that i get to show it as Hebrew and by that from right to left ?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.