• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 242
  • Last Modified:

Need help modifying my HTML page to work with a PHP form

Here is my HTML page, I need help getting it to work with my PHP form:

<html>

<head>
<title>Bioness Facilities Request</title>
<style>
BODY{color:#000000; font-size: 8pt; font-family: Verdana}
.button {background-color: rgb(128,128,128); color:#ffffff; font-size: 8pt;}
.inputc {font-size: 8pt;}
.style3 {font-size: xx-small}
</style>
<meta name="Microsoft Theme" content="none, default">
</head>

<body bgcolor="#191919">

<form name="phpformmailer" action="contact_process.php" align="center" method="post">
  <div align="center"><center>
      &nbsp;<table bgcolor="#F2F2F2" width="742" cellspacing="6" style="border-color: #CCCC99" border="1">
    <tr>
      <td width="210">&nbsp;</td>
      <td width="504"><font face="Arial"><b>Bioness Facilities Request</b></font></td>
    </tr>
    <tr>
      <td align="right" width="210"><font face="Arial"><small>Your name:</small></font></td>
      <td width="504"><font face="Arial"><input class="inputc" size="50" name="name">
      </font></td>
    </tr>
    <tr>
      <td align="right" width="210"><font face="Arial"><font color="#000080" size="1">*</font><small> Your email
      address:</small></font></td>
      <td align="left" width="504"><font face="Arial"><input class="inputc" size="50"
      name="email">&nbsp;<font size="1">&nbsp; </font><font size="2">This will
            be the reply-to emails address</font></font></td>
    </tr>
    <tr>
      <td align="right" width="210"><font face="Arial"><font color="#000080" size="1">*</font><small>
            Short Description of problem:</small></font></td>
      <td width="504"><font face="Arial">
            <input class="inputc" size="90" name="thesubject">
      </font></td>
    </tr>
    <tr>
      <td align="right" width="210" height="31"><font face="Arial" size="2">
            Phone Number</font></td>
      <td width="504" height="31"><font face="Arial">
            <input class="inputc" size="30" name="thephone">
      </font></td>
    </tr>
   
        <tr>
      <td align="right" width="210"><font face="Arial"><font color="#000080" size="1">*</font><small>
            Location of issue:</small></font></td>
      <td width="504"><font face="Arial">
            <input class="inputc" size="62" name="thelocation">
      </font></td>
    </tr>
   
   
            <tr>
      <td align="right" width="210"><font face="Arial"><font color="#000080" size="1">*</font><small>
            Date Needed By:</small></font></td>
      <td width="504"><font face="Arial">
            <input class="inputc" size="35" name="thedateneeded">
      </font></td>
    </tr>
   
                <tr>
      <td align="right" width="210"><font face="Arial"><font color="#000080" size="1">*</font><small>
            Department to be billed:</small></font></td>
      <td width="504"><font face="Arial">
            <input class="inputc" size="35" name="thedepartment">
      </font></td>
    </tr>
   
   
   
    <tr>
      <td align="right" width="210" height="141"><font face="Arial">&nbsp;
        </font>
        <p><font face="Arial"><font color="#000080" size="1">*</font><small>
            
            
            Description of work needed:</small></font></td>
      <td width="504" height="141"><font face="Arial"><textarea style="FONT-SIZE: 10pt" name="themessage" rows="7" cols="60"></textarea></font></td>
    </tr>
    <tr>
      <td width="210"></td>
      <td width="504"><p>
        <font face="Arial">
        <input type="button" class="button"
      value="Send" name="B1" ONCLICK="javascript:validateForm()">
          </font>
          <small> <small><font face="Arial">You must fill in
        the fields marked with a *</font></p>
        </td>
    </tr>
  </table>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
  </center></div>
</form>

<font face="Arial">

<script language="JavaScript"><!--
function validateForm()
{
 var okSoFar=true
 with (document.phpformmailer)
 {
  var foundAt = email.value.indexOf("@",0)
  if (foundAt < 1 && okSoFar)
  {
    okSoFar = false
    alert ("Please enter a valid email address.")
    email.focus()
  }
  var e1 = email.value
  var e2 = email2.value
  if (!(e1==e2) && okSoFar)
  {
    okSoFar = false
    alert ("Email addresses you entered do not match.  Please re-enter.")
    email.focus()
  }
  if (thesubject.value=="" && okSoFar)
  {
    okSoFar=false
    alert("Please enter the subject.")
    thesubject.focus()
  }
  if (themessage.value=="" && okSoFar)
  {
    okSoFar=false
    alert("Please enter the details for your enquiry.")
    themessage.focus()
  }
  if (okSoFar==true)  submit();
 }
}
// --></script>


</font>

</body>
</html>



See this question for details:
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_23776257.html?cid=239#a22610107
0
rustyrpage
Asked:
rustyrpage
  • 28
  • 24
  • 2
1 Solution
 
scrathcyboyCommented:
summarize the current state of what is NOT working, so we can address those exact problems.  Right now, you are asking people to try to guess what you can summarize in one sentence, no?
0
 
EMB01Commented:
Okay, you'll just need to change it to the following. Make sure your contact_process.php page has the previous script on it. Note: I've updated the script to support today's date, check out the updated PHP script on the previous page:
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_23776257.html?cid=239#a22610107

Let me know if you have any other questions!
<form name="phpformmailer" action="contact_process.php" align="center" method="post">
  <div align="center"><center>
      &nbsp;<table bgcolor="#F2F2F2" width="742" cellspacing="6" style="border-color: #CCCC99" border="1">
    <tr>
      <td width="210">&nbsp;</td>
      <td width="504"><font face="Arial"><b>Bioness Facilities Request</b></font></td>
    </tr>
    <tr>
      <td align="right" width="210"><font face="Arial"><small>Your name:</small></font></td>
      <td width="504"><font face="Arial"><input class="inputc" size="50" id="requester" name="name">
      </font></td>
    </tr>
    <tr>
      <td align="right" width="210"><font face="Arial"><font color="#000080" size="1">*</font><small> Your email
      address:</small></font></td>
      <td align="left" width="504"><font face="Arial"><input class="inputc" size="50" id="email" 
      name="email">&nbsp;<font size="1">&nbsp; </font><font size="2">This will 
            be the reply-to emails address</font></font></td>
    </tr>
    <tr>
      <td align="right" width="210"><font face="Arial"><font color="#000080" size="1">*</font><small> 
            Short Description of problem:</small></font></td>
      <td width="504"><font face="Arial">
            <input class="inputc" size="90" id="bdesc" name="thesubject">
      </font></td>
    </tr>
    <tr>
      <td align="right" width="210" height="31"><font face="Arial" size="2">
            Phone Number</font></td>
      <td width="504" height="31"><font face="Arial">
            <input class="inputc" size="30" id="phone" name="thephone">
      </font></td>
    </tr>
    
        <tr>
      <td align="right" width="210"><font face="Arial"><font color="#000080" size="1">*</font><small> 
            Location of issue:</small></font></td>
      <td width="504"><font face="Arial">
            <input class="inputc" size="62" id="loc" name="thelocation">
      </font></td>
    </tr>
    
    
            <tr>
      <td align="right" width="210"><font face="Arial"><font color="#000080" size="1">*</font><small> 
            Date Needed By:</small></font></td>
      <td width="504"><font face="Arial">
            <input class="inputc" size="35" id="cdate" name="thedateneeded">
      </font></td>
    </tr>
    
                <tr>
      <td align="right" width="210"><font face="Arial"><font color="#000080" size="1">*</font><small> 
            Department to be billed:</small></font></td>
      <td width="504"><font face="Arial">
            <input class="inputc" size="35" id="dept" name="thedepartment">
      </font></td>
    </tr>
    
    
    
    <tr>
      <td align="right" width="210" height="141"><font face="Arial">&nbsp;
        </font>
        <p><font face="Arial"><font color="#000080" size="1">*</font><small> 
            
            
            Description of work needed:</small></font></td>
      <td width="504" height="141"><font face="Arial"><textarea style="FONT-SIZE: 10pt" id="desc" name="themessage" rows="7" cols="60"></textarea></font></td>
    </tr>
    <tr>
      <td width="210"></td>
      <td width="504"><p>
        <font face="Arial">
        <input type="button" class="button"
      value="Send" name="B1" ONCLICK="javascript:validateForm()">
          </font>
          <small> <small><font face="Arial">You must fill in
        the fields marked with a *</font></p>
        </td>
    </tr>
  </table>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
  </center></div>
</form>

Open in new window

0
 
rustyrpageAuthor Commented:
When I hit the submit button, nothing happens (it just says ERROR on the page)  Am I missing something totally simple?
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
EMB01Commented:
Okay, post up your code for both pages so I can take a look.
0
 
EMB01Commented:
By the way, lets change your HTML to this and give it a try before you send your pages' code. (We're changing the NAME attributes of the input fields.)
<form name="phpformmailer" action="contact_process.php" align="center" method="post">
  <div align="center"><center>
      &nbsp;<table bgcolor="#F2F2F2" width="742" cellspacing="6" style="border-color: #CCCC99" border="1">
    <tr>
      <td width="210">&nbsp;</td>
      <td width="504"><font face="Arial"><b>Bioness Facilities Request</b></font></td>
    </tr>
    <tr>
      <td align="right" width="210"><font face="Arial"><small>Your name:</small></font></td>
      <td width="504"><font face="Arial"><input class="inputc" size="50" id="requester" name="requester">
      </font></td>
    </tr>
    <tr>
      <td align="right" width="210"><font face="Arial"><font color="#000080" size="1">*</font><small> Your email
      address:</small></font></td>
      <td align="left" width="504"><font face="Arial"><input class="inputc" size="50" id="email" 
      name="email">&nbsp;<font size="1">&nbsp; </font><font size="2">This will 
            be the reply-to emails address</font></font></td>
    </tr>
    <tr>
      <td align="right" width="210"><font face="Arial"><font color="#000080" size="1">*</font><small> 
            Short Description of problem:</small></font></td>
      <td width="504"><font face="Arial">
            <input class="inputc" size="90" id="bdesc" name="bdesc">
      </font></td>
    </tr>
    <tr>
      <td align="right" width="210" height="31"><font face="Arial" size="2">
            Phone Number</font></td>
      <td width="504" height="31"><font face="Arial">
            <input class="inputc" size="30" id="phone" name="phone">
      </font></td>
    </tr>
    
        <tr>
      <td align="right" width="210"><font face="Arial"><font color="#000080" size="1">*</font><small> 
            Location of issue:</small></font></td>
      <td width="504"><font face="Arial">
            <input class="inputc" size="62" id="loc" name="loc">
      </font></td>
    </tr>
    
    
            <tr>
      <td align="right" width="210"><font face="Arial"><font color="#000080" size="1">*</font><small> 
            Date Needed By:</small></font></td>
      <td width="504"><font face="Arial">
            <input class="inputc" size="35" id="cdate" name="cdate">
      </font></td>
    </tr>
    
                <tr>
      <td align="right" width="210"><font face="Arial"><font color="#000080" size="1">*</font><small> 
            Department to be billed:</small></font></td>
      <td width="504"><font face="Arial">
            <input class="inputc" size="35" id="dept" name="dept">
      </font></td>
    </tr>
    
    
    
    <tr>
      <td align="right" width="210" height="141"><font face="Arial">&nbsp;
        </font>
        <p><font face="Arial"><font color="#000080" size="1">*</font><small> 
            
            
            Description of work needed:</small></font></td>
      <td width="504" height="141"><font face="Arial"><textarea style="FONT-SIZE: 10pt" id="desc" name="desc" rows="7" cols="60"></textarea></font></td>
    </tr>
    <tr>
      <td width="210"></td>
      <td width="504"><p>
        <font face="Arial">
        <input type="button" class="button"
      value="Send" name="B1" ONCLICK="javascript:validateForm()">
          </font>
          <small> <small><font face="Arial">You must fill in
        the fields marked with a *</font></p>
        </td>
    </tr>
  </table>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
  </center></div>
</form>

Open in new window

0
 
rustyrpageAuthor Commented:
Here is Contact_process.php
<?php
 
// Assign the variables
$requester = $_POST['name'];
$phone = $_POST['thephone'];
$bdesc = $_POST['bdesc'];
$desc = $_POST['desc'];
$loc = $_POST['thelocation'];
$cdate = $_POST['thedateneeded'];
$dept = $_POST['thedepartment'];
$email = $_POST['email'];
 
// Mail
$static = "myemail@mydomain.com";
$subject = $bdesc;
$body = $requester . "<br>" . $phone . "<br>" . $desc;
$headers = 
      "From: " . $email . \r\n" . 
      "Reply-To: " . $email . \r\n" . 
      "X-Mailer: PHP/" . phpversion();
mail($static, $subject, $body, $headers);
 
?>

Open in new window

0
 
rustyrpageAuthor Commented:
Here is contact.html
<form name="phpformmailer" action="contact_process.php" align="center" method="post">
  <div align="center"><center>
      &nbsp;<table bgcolor="#F2F2F2" width="742" cellspacing="6" style="border-color: #CCCC99" border="1">
    <tr>
      <td width="210">&nbsp;</td>
      <td width="504"><font face="Arial"><b>Bioness Facilities Request</b></font></td>
    </tr>
    <tr>
      <td align="right" width="210"><font face="Arial"><small>Your name:</small></font></td>
      <td width="504"><font face="Arial"><input class="inputc" size="50" id="requester" name="name">
      </font></td>
    </tr>
    <tr>
      <td align="right" width="210"><font face="Arial"><font color="#000080" size="1">*</font><small> Your email
      address:</small></font></td>
      <td align="left" width="504"><font face="Arial"><input class="inputc" size="50" id="email" 
      name="email">&nbsp;<font size="1">&nbsp; </font><font size="2">This will 
            be the reply-to emails address</font></font></td>
    </tr>
    <tr>
      <td align="right" width="210"><font face="Arial"><font color="#000080" size="1">*</font><small> 
            Short Description of problem:</small></font></td>
      <td width="504"><font face="Arial">
            <input class="inputc" size="90" id="bdesc" name="thesubject">
      </font></td>
    </tr>
    <tr>
      <td align="right" width="210" height="31"><font face="Arial" size="2">
            Phone Number</font></td>
      <td width="504" height="31"><font face="Arial">
            <input class="inputc" size="30" id="phone" name="thephone">
      </font></td>
    </tr>
    
        <tr>
      <td align="right" width="210"><font face="Arial"><font color="#000080" size="1">*</font><small> 
            Location of issue:</small></font></td>
      <td width="504"><font face="Arial">
            <input class="inputc" size="62" id="loc" name="thelocation">
      </font></td>
    </tr>
    
    
            <tr>
      <td align="right" width="210"><font face="Arial"><font color="#000080" size="1">*</font><small> 
            Date Needed By:</small></font></td>
      <td width="504"><font face="Arial">
            <input class="inputc" size="35" id="cdate" name="thedateneeded">
      </font></td>
    </tr>
    
                <tr>
      <td align="right" width="210"><font face="Arial"><font color="#000080" size="1">*</font><small> 
            Department to be billed:</small></font></td>
      <td width="504"><font face="Arial">
            <input class="inputc" size="35" id="dept" name="thedepartment">
      </font></td>
    </tr>
    
    
    
    <tr>
      <td align="right" width="210" height="141"><font face="Arial">&nbsp;
        </font>
        <p><font face="Arial"><font color="#000080" size="1">*</font><small> 
            
            
            Description of work needed:</small></font></td>
      <td width="504" height="141"><font face="Arial"><textarea style="FONT-SIZE: 10pt" id="desc" name="themessage" rows="7" cols="60"></textarea></font></td>
    </tr>
    <tr>
      <td width="210"></td>
      <td width="504"><p>
        <font face="Arial">
        <input type="button" class="button"
      value="Send" name="B1" ONCLICK="javascript:validateForm()">
          </font>
          <small> <small><font face="Arial">You must fill in
        the fields marked with a *</font></p>
        </td>
    </tr>
  </table>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
  </center></div>
</form>

Open in new window

0
 
EMB01Commented:
Also, add this line to display errors to your PHP script:
error_reporting(E_ALL);

The full PHP script is attached.
<?php
 
// Report PHP errors
error_reporting(E_ALL);
 
// Assign the variables
$requester = $_POST['name'];
$phone = $_POST['thephone'];
$bdesc = $_POST['bdesc'];
$desc = $_POST['desc'];
$loc = $_POST['thelocation'];
$cdate = $_POST['thedateneeded'];
$dept = $_POST['thedepartment'];
$email = $_POST['email'];
 
// Mail
$static = "myemail@mydomain.com";
$subject = $bdesc;
$body = $requester . "<br>" . $phone . "<br>" . $desc;
$headers = 
      "From: " . $email . \r\n" . 
      "Reply-To: " . $email . \r\n" . 
      "X-Mailer: PHP/" . phpversion();
mail($static, $subject, $body, $headers);
 
?>

Open in new window

0
 
rustyrpageAuthor Commented:
No error pops up, but when I hit the send button, it acts like there is no activity associated with send...so, it just keeps letting me press it over & over again
0
 
EMB01Commented:
I noticed you changed your $_POST variables. Make sure they're the same for each. I also noticed a syntax error. Here's the script I want you to use in combination with the HTML script I provided above (ID: 22616036).
<?php
 
// Report PHP errors
error_reporting(E_ALL);
 
// Assign the variables
$requester = $_POST['requester'];
$phone = $_POST['phone'];
$date = date(F j, Y);
$bdesc = $_POST['bdesc'];
$desc = $_POST['desc'];
$loc = $_POST['loc'];
$cdate = $_POST['cdate'];
$dept = $_POST['dept'];
$email = $_POST['email'];
 
// Mail
$static = "you@yourdomain.com";
$subject = $bdesc;
$body = $requester . "<br>" . $phone;
$headers = 
      "From: " . $email . "\r\n" . 
      "Reply-To: " . $email . "\r\n" . 
      "X-Mailer: PHP/" . phpversion();
mail($static, $subject, $body, $headers);
 
?>

Open in new window

0
 
rustyrpageAuthor Commented:
I thought I had changed them to match what was identified in the form.

Still the same thing with the send button not working
0
 
EMB01Commented:
You say your send button doesn't work? I think it should look like this:
<input type="submit" class="button"
      value="Send" name="B1" ONCLICK="javascript:validateForm()">

If that doesn't work, let me see your JavaScript code, that's probably what's holding things up.
0
 
rustyrpageAuthor Commented:
That's probably what's holding things up - I don't have a javascript code.  Sorry, I don't have a javascript code, so that is more than likely where my issue is?  Where would I have to put it?
0
 
EMB01Commented:
We can add JavaScript validation later (in a new question if you want!) Firstly, just change your submit button to this and try submitting the form:
<input type="submit" class="button"
      value="Send" name="B1">
0
 
rustyrpageAuthor Commented:
Parse error: syntax error, unexpected T_STRING in C:\www\webroot\Email\contact_process.php on line 9

That said, I don't need the date field anymore as it will obviously be attached to the email's date.  (however, I still need the date of completion.

Should I just remove that line?
0
 
rustyrpageAuthor Commented:
Scratch that, it worked.

The only other thing (last thing?) is that the <BR> actually shows up in the email instead of being a new line.

Did I do something wrong?
0
 
EMB01Commented:
You can remove it if you please. And; no, we just have to change the mail header adding this:
"Content-type:text/html;charset=iso-8859-1" . "\r\n";

I've changed the script, removing the date and adding the content type. It's attached below...

Let me know if you want to add validation and we can open a new question.
<?php
 
// Report PHP errors
error_reporting(E_ALL);
 
// Assign the variables
$requester = $_POST['requester'];
$phone = $_POST['phone'];
$bdesc = $_POST['bdesc'];
$desc = $_POST['desc'];
$loc = $_POST['loc'];
$cdate = $_POST['cdate'];
$dept = $_POST['dept'];
$email = $_POST['email'];
 
// Mail
$static = "you@yourdomain.com";
$subject = $bdesc;
$body = $requester . "<br>" . $phone;
$headers = 
      "From: " . $email . "\r\n" . 
      "Reply-To: " . $email . "\r\n" . 
      "Content-type: text/html;charset=iso-8859-1" . "\r\n";
      "X-Mailer: PHP/" . phpversion();
mail($static, $subject, $body, $headers);
 
?>

Open in new window

0
 
EMB01Commented:
Also, change the <br> to <br />.
0
 
rustyrpageAuthor Commented:
Now the email looks like:

Name<br />Phone Number<br />LongDescription<br />Location<br />DateNeeded<br />Department
0
 
EMB01Commented:
Sorry, throw this in there too...
"MIME-Version: 1.0" . "\r\n";
// Mail
$static = "you@yourdomain.com";
$subject = $bdesc;
$body = $requester . "<br>" . $phone;
$headers = 
      "From: " . $email . "\r\n" . 
      "Reply-To: " . $email . "\r\n" . 
      "MIME-Version: 1.0" . "\r\n" . 
      "Content-type: text/html;charset=iso-8859-1" . "\r\n" .
      "X-Mailer: PHP/" . phpversion();
mail($static, $subject, $body, $headers);

Open in new window

0
 
rustyrpageAuthor Commented:
Also, I thought I could add tags to the front of each line too, but apparently not.

I tried:

$body = "Requesters Name:" $requester . "<br>" . "Requester's Number" $phone . "<br>" . $desc . "<br>" . $loc . "<br>" . $cdate . "<br>" . $dept;
0
 
rustyrpageAuthor Commented:
By the way - it still has the <BR> in it
0
 
EMB01Commented:
Did you change these tags to <br />
0
 
rustyrpageAuthor Commented:
I tried that too & it just shows <br /> in the text
0
 
EMB01Commented:
There is also an error in your code syntax:
$body = "Requesters Name:" $requester . "<br>" . "Requester's Number" $phone . "<br>" . $desc . "<br>" . $loc . "<br>" . $cdate . "<br>" . $dept;

Should be:
$body = "Requesters Name:" . $requester . "<br />" . "Requester's Number" . $phone . "<br />" . $desc . "<br />" . $loc . "<br />" . $cdate . "<br />" . $dept;
0
 
EMB01Commented:
Maybe your host blocks HTML messages, who is your host?
0
 
rustyrpageAuthor Commented:
Me - I don't block HTML messages as that is how the message is coming through.

Once I changed your code to be what you said above, I now get this error when hitting send:

$body = "Requesters Name:" . $requester . "<br />" . "Requester's Number" . $phone . "<br />" . $desc . "<br />" . $loc . "<br />" . $cdate . "<br />" . $dept;
0
 
EMB01Commented:
Try this instead of using <br />:
$body = "Requesters Name:" . $requester . \n . "Requester's Number" . $phone . \n . $desc . \n . $loc . \n . $cdate . \n . $dept;
0
 
rustyrpageAuthor Commented:
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in C:\www\webroot\contact_process.php on line 20
0
 
EMB01Commented:
Try putting the \n's in quotes like this:
$body = "Requesters Name:" . $requester . "\n" . "Requester's Number" . $phone . "\n" . $desc . "\n" . $loc . "\n" . $cdate . "\n" . $dept;
0
 
rustyrpageAuthor Commented:
Now they don't show up, but there is no line either (all one line):

Requesters Name:Your Name Requester's NumberPhone Number Description of work Location Date Needed Department
0
 
rustyrpageAuthor Commented:
Okay, so I guess I didn't add a period to the end of the
"Content-type: text/html;charset=iso-8859-1" . "\r\n" .

Something like that, I just completely re-copied what you pasted above & it worked.

THANKS!
0
 
EMB01Commented:
Don't know what I was thinking... just use this:
$body = "Requesters Name:" . $requester . "\r\n" . "Requester's Number" . $phone . "\r\n" . $desc . "\r\n" . $loc . "\r\n" . $cdate . "\r\n" . $dept;
0
 
rustyrpageAuthor Commented:
I got it to work with:

$body = "Requesters Name:     " . $requester . "<br>" . "Requester's Phone Number:     " . $phone . "<br>" ."Problem Description:     " . $desc . "<br>" . "Location:     " .$loc . "<br>" ."Date needed by:     " . $cdate . "<br>" . "Requester's Department:     " . $dept;


Now, last question, how can bold the line title (ie "Requester's Phone Number:"
0
 
EMB01Commented:
Don't mention it. Are you going to add JS validation now?
0
 
rustyrpageAuthor Commented:
What would the JS validation validate?
0
 
EMB01Commented:
To bold something, just do this:
$body = <strong> . "Requesters Name:     " . </strong> . $requester . "<br>" . "Requester's Phone Number:     " . $phone . "<br>" ."Problem Description:     " . $desc . "<br>" . "Location:     " .$loc . "<br>" ."Date needed by:     " . $cdate . "<br>" . "Requester's Department:     " . $dept;
0
 
EMB01Commented:
It would validation the user's input. For example, if you wanted to validate for real email addresses, the script wouldn't send until a real email address was entered.
0
 
rustyrpageAuthor Commented:
It doesn't like the <strong> </strong>
0
 
EMB01Commented:
Sorry, I forgot the quotations:
$body = "<strong>" . "Requesters Name:     " . "</strong>" . $requester . "<br>" . "Requester's Phone Number:     " . $phone . "<br>" ."Problem Description:     " . $desc . "<br>" . "Location:     " .$loc . "<br>" ."Date needed by:     " . $cdate . "<br>" . "Requester's Department:     " . $dept;
0
 
rustyrpageAuthor Commented:
Final:
<?php
 
// Report PHP errors
error_reporting(E_ALL);
 
// Assign the variables
$requester = $_POST['requester'];
$phone = $_POST['phone'];
//$date = date(F j, Y);
$bdesc = $_POST['bdesc'];
$desc = $_POST['desc'];
$loc = $_POST['loc'];
$cdate = $_POST['cdate'];
$dept = $_POST['dept'];
$email = $_POST['email'];
 
// Mail
$static = "emailme@here.com";
$subject = $bdesc;
$body = "<strong>"."Requester's Name:     " ."</strong>". $requester . "<br>" . "<strong>". "Requester's Phone Number:     " ."</strong>". $phone . "<br>" ."<strong>"."Problem Description:     " ."</strong>". $desc . "<br>" . "<strong>"."Location:     " ."</strong>".$loc . "<br>" ."<strong>"."Date needed by:     "."</strong>" . $cdate . "<br>" ."<strong>". "Requester's Department:     " ."</strong>". $dept;
$headers = 
      "From: " . $email . "\r\n" . 
      "Reply-To: " . $email . "\r\n" . 
      "MIME-Version: 1.0" . "\r\n" . 
      "Content-type: text/html;charset=iso-8859-1" . "\r\n" .
      "X-Mailer: PHP/" . phpversion();
mail($static, $subject, $body, $headers);
 
 
?>

Open in new window

0
 
rustyrpageAuthor Commented:
THANK YOU SOOO MUCH!
0
 
rustyrpageAuthor Commented:
Where would I throw the re-direct for the Thank you page?  Right now it just goes to white.
0
 
EMB01Commented:
Right on your contact_process.php page. Otherwise, we can build it into your script, just include a redirect. For the first option, just put your PHP script at the top, then your HTML below it. For the second option, let me know and I'll tell you what to do.
0
 
rustyrpageAuthor Commented:
Whatever is easiest...I just want it to go to a thankyou.html page instead of the blank page.
0
 
rustyrpageAuthor Commented:
Let me know if it is HTML or PHP & I can make a new question
0
 
EMB01Commented:
Alright, make a new question for PHP and let me know where. It should be pretty simple to do...
0
 
scrathcyboyCommented:
sorry I get involved in this one.
0
 
rustyrpageAuthor Commented:
One other problem:

Right now, the email goes into our ticketing system, which just garbles it all together anyway.  What would it take to put () around each of the lines in the email?

IE:

(Requester's Name:  My Name)  (Requester's Phone:  My Phone)

Let me know if that is even possible.
0
 
rustyrpageAuthor Commented:
NEvermind, I got it
0
 
EMB01Commented:
That should be easy. Make it like this:
$body = "<strong>"."(Requester's Name:     " ."</strong>". $requester . ")" . "<br>" . "<strong>". "(Requester's Phone Number:     " ."</strong>". $phone . ")" . "<br>" ."<strong>"."(Problem Description:     " ."</strong>". $desc . ")" . "<br>" . "<strong>"."(Location:     " ."</strong>".$loc . ")" . "<br>" ."<strong>"."(Date needed by:     "."</strong>" . $cdate . ")" . "<br>" ."<strong>". "(Requester's Department:     " ."</strong>". $dept . ")";
0
 
rustyrpageAuthor Commented:
Now here's something strange:

If I send an email from Outlook to our ticketing system, it reads it just fine (with the lines & font sizes etc).  When I send it from the page we just made, it puts everything into a big paragrah & jumbled together.

Is there ANY way to fix that?   It makes it very hard to read (even after adding ( )
0
 
EMB01Commented:
So, the ticket system must not be reading the linebreaks. Could you try replacing the <br> tags with <br /> or "\r\n", please?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 28
  • 24
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now