ComputerTechie
asked on
Fix Email Form output
Hello I hope someone is able to help with this problem I don't know php very well.
I have the following email form:
<?php
$my_email = "emailaddres@emailaddress. com";
if ($_SERVER['REQUEST_METHOD' ] != "POST"){exit;}
$message = "";
while(list($key,$value) = each($_POST)){if(!(empty($ value))){$ set=1;}$me ssage = $message . "$key: $value\n\n";} if($set!==1){header("locat ion: $_SERVER[HTTP_REFERER]");e xit;}
$subject = "New Sign Up";
$headers = "From: " . $_POST['Email'] . "\n" . "Return-Path: " . $_POST['Email'] . "\n" . "Reply-To: " . $_POST['Email'] . "\n";
mail($my_email,$subject,$m essage,$he aders);
?>
This works fine. What I need it the following changes to the php code to put the phone number on one line as phone number and not the filed names.
.
Here is the form that is sending the data.
<script language="JavaScript">
function checkrequired(which) {
var pass=true;
if (document.images) {
for (i=0;i<which.length;i++) {
var tempobj=which.elements[i];
if (tempobj.name.substring(0, 8)=="requi red") {
if (((tempobj.type=="text"||t empobj.typ e=="textar ea")&&
tempobj.value=='')||(tempo bj.type.to String().c harAt(0)== "s"&&
tempobj.selectedIndex==0)) {
pass=false;
break;
}
}
}
}
if (!pass) {
shortFieldName=tempobj.nam e.substrin g(8,30).to UpperCase( );
alert("Please make sure the "+shortFieldName+" field was properly completed.");
return false;
}
else
return true;
}
</script>
<form action="pstingform.php" method="POST" ">
<table cellSpacing="0" cellPadding="0" width="90%" align="center" bgColor="#000000" border="0">
<tr>
<td style="font-size: 10pt; font-family: MS Sans Serif">
<div class="ABCONFLIST">
<table cellSpacing="1" cellPadding="2" width="100%" align="center" border="0">
<tr bgColor="#cccccc">
<td class="PFTDL" vAlign="top" bgcolor="#8F7AA0"><font color="#FFFFFF" size="3" face="Arial Narrow"><strong>*Select
City Board</strong></font></td>
<td class="PFTDR" bgcolor="#8F7AA0"><select name="City">
<option value="Colorado" selected>Colorado</option>
<option value="Dallas">Dallas</opt ion>
<option value="Houston">Houston</o ption>
<option value="Seattle">Seattle</o ption>
<option value="Other">Other</optio n>
</select></td>
</tr>
<tr bgColor="#cccccc">
<td class="PFTDL" vAlign="top" width="35%" bgcolor="#8F7AA0"><b>
<font color="#FFFFFF" face="Arial Narrow" size="3">* Name</font></b></td>
<td class="PFTDR" bgcolor="#8F7AA0"> <input type="text" size="40" name="Name" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt" id="requiredName"></td>
</tr>
<tr>
<td class="PFTDL" vAlign="top" bgcolor="#8F7AA0"><b><font color="#FFFFFF" face="Arial Narrow" size="3">*
Phone number - IMPORTANT!</font></b></td>
<td class="PFTDR" bgcolor="#8F7AA0">(
<input name="requiredArea-Code" type="text" size="3" maxlength="3" value="" tabindex="1" onkeyup="return autoTab(this,3,event);">
)
<input name="requiredPrefix-Of-Ph one-Number " type="text" size="3" maxlength="3" value="" tabindex="2" onkeyup="return autoTab(this,3,event);">
-
<input name="requiredLast-4-Digit s-Of-Phone " type="text" size="4" maxlength="4" value="" tabindex="3"></td>
</tr>
<tr>
<td class="PFTDL" vAlign="top" width="35%" bgcolor="#8F7AA0"><b>
<font color="#FFFFFF" face="Arial Narrow" size="3">* Email address</font></b></td>
<td class="PFTDR" bgcolor="#8F7AA0"> <input type="text" size="40" name="EmailAddress" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt"id="requiredEmail"></t d>
</tr>
<tr>
<td class="PFTDL" vAlign="top" width="35%" bgcolor="#8F7AA0"><b>
<font color="#FFFFFF" face="Arial Narrow" size="3">* Independent
or agency?</font></b></td>
<td class="PFTDR" bgcolor="#8F7AA0"> <input type="text" size="40" name="IndependentOrAgency" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt" id="requiredIndependentAge ncy"></td>
</tr>
<tr bgColor="#cccccc">
<td class="PFTDL" vAlign="top" width="35%" bgcolor="#8F7AA0"><b>
<font color="#FFFFFF" face="Arial Narrow" size="3">* Posting Name(s)</font></b></td>
<td class="PFTDR" bgcolor="#8F7AA0"> <input type="text" size="40" name="PostingName" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt" id="requiredPostingName">< /td>
</tr>
<tr bgColor="#cccccc">
<td class="PFTDL" vAlign="top" width="35%" bgcolor="#8F7AA0"><b>
<font color="#FFFFFF" face="Arial Narrow" size="3">* Password</font></b></td>
<td class="PFTDR" bgcolor="#8F7AA0"> <input type="text" size="40" name="Password" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt" id="requiredPassword"></td >
</tr>
<tr>
<td class="PFTDL" vAlign="top" width="35%" bgcolor="#8F7AA0"><b>
<font color="#FFFFFF" face="Arial Narrow" size="3">* Retype Password</font></b></td>
<td class="PFTDR" bgcolor="#8F7AA0"> <input type="text" size="40" name="RetypePassword" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt" id="requiredRetypePassword "></td>
</tr>
<tr bgColor="#cccccc">
<td class="PFTDL" vAlign="top" width="35%" bgcolor="#8F7AA0"> </ td>
<td class="PFTDR" bgcolor="#8F7AA0"> </ td>
</tr>
<tr bgColor="#cccccc">
<td class="PFTDL" vAlign="top" width="35%" bgcolor="#8F7AA0"> <font color="#FFFFFF" face="Arial Narrow" size="3"><b>Notes:</b></fo nt></td>
<td class="PFTDR" bgcolor="#8F7AA0"> <textarea rows="15" name="Notes" cols="48"></textarea></td>
</tr>
<tr bgColor="#efefee">
<td style="font-size: 10pt; font-family: MS Sans Serif" bgcolor="#8F7AA0" align="center">
<input class="buttonstyle" type="reset" value="Reset"> </td>
<td style="font-size: 10pt; font-family: MS Sans Serif" bgcolor="#8F7AA0" align="center">
<br> <input class="buttonstyle" type="submit" value="Submit!">
<br> </td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</form>
here is the current output and what i could like to get.
Current PHP
City: Colorado
Name: form test
requiredArea-Code: 999
requiredPrefix-Of-Phone-Nu mber: 999
requiredLast-4-Digits-Of-P hone: 9999
EmailAddress: email@emailaddress.com
IndependentOrAgency: independent
PostingName: niteone
Password: 123199
RetypePassword: 123199
Notes: kl
Needed look
City: Colorado
Name: form test
Phone: 999-999-9999
EmailAddress: email@emaiaddress.com
IndependentOrAgency: independent
PostingName: niteone
Password: 123199
RetypePassword: 123199
Notes: kl
Thank you in advance.
I have the following email form:
<?php
$my_email = "emailaddres@emailaddress.
if ($_SERVER['REQUEST_METHOD'
$message = "";
while(list($key,$value) = each($_POST)){if(!(empty($
$subject = "New Sign Up";
$headers = "From: " . $_POST['Email'] . "\n" . "Return-Path: " . $_POST['Email'] . "\n" . "Reply-To: " . $_POST['Email'] . "\n";
mail($my_email,$subject,$m
?>
This works fine. What I need it the following changes to the php code to put the phone number on one line as phone number and not the filed names.
.
Here is the form that is sending the data.
<script language="JavaScript">
function checkrequired(which) {
var pass=true;
if (document.images) {
for (i=0;i<which.length;i++) {
var tempobj=which.elements[i];
if (tempobj.name.substring(0,
if (((tempobj.type=="text"||t
tempobj.value=='')||(tempo
tempobj.selectedIndex==0))
pass=false;
break;
}
}
}
}
if (!pass) {
shortFieldName=tempobj.nam
alert("Please make sure the "+shortFieldName+" field was properly completed.");
return false;
}
else
return true;
}
</script>
<form action="pstingform.php" method="POST" ">
<table cellSpacing="0" cellPadding="0" width="90%" align="center" bgColor="#000000" border="0">
<tr>
<td style="font-size: 10pt; font-family: MS Sans Serif">
<div class="ABCONFLIST">
<table cellSpacing="1" cellPadding="2" width="100%" align="center" border="0">
<tr bgColor="#cccccc">
<td class="PFTDL" vAlign="top" bgcolor="#8F7AA0"><font color="#FFFFFF" size="3" face="Arial Narrow"><strong>*Select
City Board</strong></font></td>
<td class="PFTDR" bgcolor="#8F7AA0"><select name="City">
<option value="Colorado" selected>Colorado</option>
<option value="Dallas">Dallas</opt
<option value="Houston">Houston</o
<option value="Seattle">Seattle</o
<option value="Other">Other</optio
</select></td>
</tr>
<tr bgColor="#cccccc">
<td class="PFTDL" vAlign="top" width="35%" bgcolor="#8F7AA0"><b>
<font color="#FFFFFF" face="Arial Narrow" size="3">* Name</font></b></td>
<td class="PFTDR" bgcolor="#8F7AA0"> <input type="text" size="40" name="Name" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt" id="requiredName"></td>
</tr>
<tr>
<td class="PFTDL" vAlign="top" bgcolor="#8F7AA0"><b><font
Phone number - IMPORTANT!</font></b></td>
<td class="PFTDR" bgcolor="#8F7AA0">(
<input name="requiredArea-Code" type="text" size="3" maxlength="3" value="" tabindex="1" onkeyup="return autoTab(this,3,event);">
)
<input name="requiredPrefix-Of-Ph
-
<input name="requiredLast-4-Digit
</tr>
<tr>
<td class="PFTDL" vAlign="top" width="35%" bgcolor="#8F7AA0"><b>
<font color="#FFFFFF" face="Arial Narrow" size="3">* Email address</font></b></td>
<td class="PFTDR" bgcolor="#8F7AA0"> <input type="text" size="40" name="EmailAddress" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt"id="requiredEmail"></t
</tr>
<tr>
<td class="PFTDL" vAlign="top" width="35%" bgcolor="#8F7AA0"><b>
<font color="#FFFFFF" face="Arial Narrow" size="3">* Independent
or agency?</font></b></td>
<td class="PFTDR" bgcolor="#8F7AA0"> <input type="text" size="40" name="IndependentOrAgency"
</tr>
<tr bgColor="#cccccc">
<td class="PFTDL" vAlign="top" width="35%" bgcolor="#8F7AA0"><b>
<font color="#FFFFFF" face="Arial Narrow" size="3">* Posting Name(s)</font></b></td>
<td class="PFTDR" bgcolor="#8F7AA0"> <input type="text" size="40" name="PostingName" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt" id="requiredPostingName"><
</tr>
<tr bgColor="#cccccc">
<td class="PFTDL" vAlign="top" width="35%" bgcolor="#8F7AA0"><b>
<font color="#FFFFFF" face="Arial Narrow" size="3">* Password</font></b></td>
<td class="PFTDR" bgcolor="#8F7AA0"> <input type="text" size="40" name="Password" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt" id="requiredPassword"></td
</tr>
<tr>
<td class="PFTDL" vAlign="top" width="35%" bgcolor="#8F7AA0"><b>
<font color="#FFFFFF" face="Arial Narrow" size="3">* Retype Password</font></b></td>
<td class="PFTDR" bgcolor="#8F7AA0"> <input type="text" size="40" name="RetypePassword" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt" id="requiredRetypePassword
</tr>
<tr bgColor="#cccccc">
<td class="PFTDL" vAlign="top" width="35%" bgcolor="#8F7AA0"> </
<td class="PFTDR" bgcolor="#8F7AA0"> </
</tr>
<tr bgColor="#cccccc">
<td class="PFTDL" vAlign="top" width="35%" bgcolor="#8F7AA0"> <font color="#FFFFFF" face="Arial Narrow" size="3"><b>Notes:</b></fo
<td class="PFTDR" bgcolor="#8F7AA0"> <textarea rows="15" name="Notes" cols="48"></textarea></td>
</tr>
<tr bgColor="#efefee">
<td style="font-size: 10pt; font-family: MS Sans Serif" bgcolor="#8F7AA0" align="center">
<input class="buttonstyle" type="reset" value="Reset"> </td>
<td style="font-size: 10pt; font-family: MS Sans Serif" bgcolor="#8F7AA0" align="center">
<br> <input class="buttonstyle" type="submit" value="Submit!">
<br> </td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</form>
here is the current output and what i could like to get.
Current PHP
City: Colorado
Name: form test
requiredArea-Code: 999
requiredPrefix-Of-Phone-Nu
requiredLast-4-Digits-Of-P
EmailAddress: email@emailaddress.com
IndependentOrAgency: independent
PostingName: niteone
Password: 123199
RetypePassword: 123199
Notes: kl
Needed look
City: Colorado
Name: form test
Phone: 999-999-9999
EmailAddress: email@emaiaddress.com
IndependentOrAgency: independent
PostingName: niteone
Password: 123199
RetypePassword: 123199
Notes: kl
Thank you in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
this worked great.
thank you i accept this answer.
thank you i accept this answer.
ASKER
give 225 to mmc98dl1
ASKER