Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2008-09-30
54
Medium Priority
?
232 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 28
  • 24
  • 2
54 Comments
 
LVL 44

Expert Comment

by:scrathcyboy
ID: 22610244
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
ID: 22610259
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
ID: 22614817
When I hit the submit button, nothing happens (it just says ERROR on the page)  Am I missing something totally simple?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 14

Expert Comment

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

Expert Comment

by:EMB01
ID: 22616036
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
ID: 22616043
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
ID: 22616045
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
ID: 22616098
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
ID: 22616125
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
ID: 22616133
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
ID: 22616140
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
ID: 22616223
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
ID: 22616247
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
ID: 22616432
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
ID: 22616466
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
ID: 22616479
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
ID: 22616577
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
ID: 22616597
Also, change the <br> to <br />.
0
 
LVL 6

Author Comment

by:rustyrpage
ID: 22616760
Now the email looks like:

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

Expert Comment

by:EMB01
ID: 22616840
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
ID: 22616842
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
ID: 22616860
By the way - it still has the <BR> in it
0
 
LVL 14

Expert Comment

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

Author Comment

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

Expert Comment

by:EMB01
ID: 22616985
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
ID: 22617002
Maybe your host blocks HTML messages, who is your host?
0
 
LVL 6

Author Comment

by:rustyrpage
ID: 22617015
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
 
LVL 14

Expert Comment

by:EMB01
ID: 22617018
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
ID: 22617046
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
ID: 22617113
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
ID: 22617128
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
ID: 22617152
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
ID: 22617166
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
ID: 22617184
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
ID: 22617182
Don't mention it. Are you going to add JS validation now?
0
 
LVL 6

Author Comment

by:rustyrpage
ID: 22617203
What would the JS validation validate?
0
 
LVL 14

Expert Comment

by:EMB01
ID: 22617209
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
ID: 22617272
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
ID: 22617277
It doesn't like the <strong> </strong>
0
 
LVL 14

Accepted Solution

by:
EMB01 earned 2000 total points
ID: 22617315
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
ID: 22617402
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
ID: 31501775
THANK YOU SOOO MUCH!
0
 
LVL 6

Author Comment

by:rustyrpage
ID: 22617541
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
ID: 22617643
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
ID: 22617677
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
ID: 22617679
Let me know if it is HTML or PHP & I can make a new question
0
 
LVL 14

Expert Comment

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

Expert Comment

by:scrathcyboy
ID: 22617756
sorry I get involved in this one.
0
 
LVL 6

Author Comment

by:rustyrpage
ID: 22617836
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
ID: 22617866
NEvermind, I got it
0
 
LVL 14

Expert Comment

by:EMB01
ID: 22617893
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
ID: 22618011
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
ID: 22618148
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

604 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