Link to home
Start Free TrialLog in
Avatar of ComputerTechie
ComputerTechieFlag for United States of America

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;}$message = $message . "$key: $value\n\n";} if($set!==1){header("location: $_SERVER[HTTP_REFERER]");exit;}

$subject = "New Sign Up";
$headers = "From: " . $_POST['Email'] . "\n" . "Return-Path: " . $_POST['Email'] . "\n" . "Reply-To: " . $_POST['Email'] . "\n";

mail($my_email,$subject,$message,$headers);

?>

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)=="required") {
if (((tempobj.type=="text"||tempobj.type=="textarea")&&
tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
tempobj.selectedIndex==0)) {
pass=false;
break;
         }
      }
   }
}
if (!pass) {
shortFieldName=tempobj.name.substring(8,30).toUpperCase();
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</option>
                  <option value="Houston">Houston</option>
                  <option value="Seattle">Seattle</option>
                  <option value="Other">Other</option>
                </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-Phone-Number" type="text" size="3" maxlength="3" value="" tabindex="2" onkeyup="return autoTab(this,3,event);">
                -
                <input name="requiredLast-4-Digits-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"></td>
            </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="requiredIndependentAgency"></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">&nbsp;</td>
              <td class="PFTDR" bgcolor="#8F7AA0">&nbsp;</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></font></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> &nbsp;</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-Number: 999

requiredLast-4-Digits-Of-Phone: 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.
ASKER CERTIFIED SOLUTION
Avatar of mmc98dl1
mmc98dl1
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ComputerTechie

ASKER

i will test the new changes today. thank you
this worked great.

thank you i accept this answer.

give 225 to mmc98dl1