Solved

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

Posted on 2008-09-30
54
200 Views
Last Modified: 2012-05-05
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
Comment
Question by:rustyrpage
  • 28
  • 24
  • 2
54 Comments
 
LVL 44

Expert Comment

by:scrathcyboy
Comment Utility
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
 
LVL 14

Expert Comment

by:EMB01
Comment Utility
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
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
When I hit the submit button, nothing happens (it just says ERROR on the page)  Am I missing something totally simple?
0
 
LVL 14

Expert Comment

by:EMB01
Comment Utility
Okay, post up your code for both pages so I can take a look.
0
 
LVL 14

Expert Comment

by:EMB01
Comment Utility
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
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
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
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
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
 
LVL 14

Expert Comment

by:EMB01
Comment Utility
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
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
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
 
LVL 14

Expert Comment

by:EMB01
Comment Utility
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
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
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
 
LVL 14

Expert Comment

by:EMB01
Comment Utility
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
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
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
 
LVL 14

Expert Comment

by:EMB01
Comment Utility
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
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
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
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
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
 
LVL 14

Expert Comment

by:EMB01
Comment Utility
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
 
LVL 14

Expert Comment

by:EMB01
Comment Utility
Also, change the <br> to <br />.
0
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
Now the email looks like:

Name<br />Phone Number<br />LongDescription<br />Location<br />DateNeeded<br />Department
0
 
LVL 14

Expert Comment

by:EMB01
Comment Utility
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
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
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
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
By the way - it still has the <BR> in it
0
 
LVL 14

Expert Comment

by:EMB01
Comment Utility
Did you change these tags to <br />
0
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
I tried that too & it just shows <br /> in the text
0
 
LVL 14

Expert Comment

by:EMB01
Comment Utility
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
 
LVL 14

Expert Comment

by:EMB01
Comment Utility
Maybe your host blocks HTML messages, who is your host?
0
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 14

Expert Comment

by:EMB01
Comment Utility
Try this instead of using <br />:
$body = "Requesters Name:" . $requester . \n . "Requester's Number" . $phone . \n . $desc . \n . $loc . \n . $cdate . \n . $dept;
0
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in C:\www\webroot\contact_process.php on line 20
0
 
LVL 14

Expert Comment

by:EMB01
Comment Utility
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
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
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
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
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
 
LVL 14

Expert Comment

by:EMB01
Comment Utility
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
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
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
 
LVL 14

Expert Comment

by:EMB01
Comment Utility
Don't mention it. Are you going to add JS validation now?
0
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
What would the JS validation validate?
0
 
LVL 14

Expert Comment

by:EMB01
Comment Utility
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
 
LVL 14

Expert Comment

by:EMB01
Comment Utility
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
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
It doesn't like the <strong> </strong>
0
 
LVL 14

Accepted Solution

by:
EMB01 earned 500 total points
Comment Utility
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
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
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
 
LVL 6

Author Closing Comment

by:rustyrpage
Comment Utility
THANK YOU SOOO MUCH!
0
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
Where would I throw the re-direct for the Thank you page?  Right now it just goes to white.
0
 
LVL 14

Expert Comment

by:EMB01
Comment Utility
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
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
Whatever is easiest...I just want it to go to a thankyou.html page instead of the blank page.
0
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
Let me know if it is HTML or PHP & I can make a new question
0
 
LVL 14

Expert Comment

by:EMB01
Comment Utility
Alright, make a new question for PHP and let me know where. It should be pretty simple to do...
0
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
0
 
LVL 44

Expert Comment

by:scrathcyboy
Comment Utility
sorry I get involved in this one.
0
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
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
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
NEvermind, I got it
0
 
LVL 14

Expert Comment

by:EMB01
Comment Utility
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
 
LVL 6

Author Comment

by:rustyrpage
Comment Utility
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
 
LVL 14

Expert Comment

by:EMB01
Comment Utility
So, the ticket system must not be reading the linebreaks. Could you try replacing the <br> tags with <br /> or "\r\n", please?
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now