rustyrpage
asked on
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.ph p" align="center" method="post">
<div align="center"><center>
<table bgcolor="#F2F2F2" width="742" cellspacing="6" style="border-color: #CCCC99" border="1">
<tr>
<td width="210"> </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></t d>
<td align="left" width="504"><font face="Arial"><input class="inputc" size="50"
name="email"> <font size="1"> </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></t d>
<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">
</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></fon t></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:valida teForm()">
</font>
<small> <small><font face="Arial">You must fill in
the fields marked with a *</font></p>
</td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
<p> </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:
https://www.experts-exchange.com/questions/23776257/Multi-Fields-in-PHP-Mailer.html?cid=239&anchorAnswerId=22610107#a22610107
<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.ph
<div align="center"><center>
<table bgcolor="#F2F2F2" width="742" cellspacing="6" style="border-color: #CCCC99" border="1">
<tr>
<td width="210"> </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></t
<td align="left" width="504"><font face="Arial"><input class="inputc" size="50"
name="email"> <font size="1"> </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></t
<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">
</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></fon
</tr>
<tr>
<td width="210"></td>
<td width="504"><p>
<font face="Arial">
<input type="button" class="button"
value="Send" name="B1" ONCLICK="javascript:valida
</font>
<small> <small><font face="Arial">You must fill in
the fields marked with a *</font></p>
</td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
<p> </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:
https://www.experts-exchange.com/questions/23776257/Multi-Fields-in-PHP-Mailer.html?cid=239&anchorAnswerId=22610107#a22610107
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?
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:
https://www.experts-exchange.com/questions/23776257/Multi-Fields-in-PHP-Mailer.html?cid=239&anchorAnswerId=22610107#a22610107
Let me know if you have any other questions!
https://www.experts-exchange.com/questions/23776257/Multi-Fields-in-PHP-Mailer.html?cid=239&anchorAnswerId=22610107#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>
<table bgcolor="#F2F2F2" width="742" cellspacing="6" style="border-color: #CCCC99" border="1">
<tr>
<td width="210"> </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"> <font size="1"> </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">
</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> </p>
<p> </p>
<p> </p>
<p> </p>
</center></div>
</form>
ASKER
When I hit the submit button, nothing happens (it just says ERROR on the page) Am I missing something totally simple?
Okay, post up your code for both pages so I can take a look.
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>
<table bgcolor="#F2F2F2" width="742" cellspacing="6" style="border-color: #CCCC99" border="1">
<tr>
<td width="210"> </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"> <font size="1"> </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">
</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> </p>
<p> </p>
<p> </p>
<p> </p>
</center></div>
</form>
ASKER
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);
?>
ASKER
Here is contact.html
<form name="phpformmailer" action="contact_process.php" align="center" method="post">
<div align="center"><center>
<table bgcolor="#F2F2F2" width="742" cellspacing="6" style="border-color: #CCCC99" border="1">
<tr>
<td width="210"> </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"> <font size="1"> </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">
</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> </p>
<p> </p>
<p> </p>
<p> </p>
</center></div>
</form>
Also, add this line to display errors to your PHP script:
error_reporting(E_ALL);
The full PHP script is attached.
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);
?>
ASKER
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
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);
?>
ASKER
I thought I had changed them to match what was identified in the form.
Still the same thing with the send button not working
Still the same thing with the send button not working
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:valida teForm()">
If that doesn't work, let me see your JavaScript code, that's probably what's holding things up.
<input type="submit" class="button"
value="Send" name="B1" ONCLICK="javascript:valida
If that doesn't work, let me see your JavaScript code, that's probably what's holding things up.
ASKER
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?
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">
<input type="submit" class="button"
value="Send" name="B1">
ASKER
Parse error: syntax error, unexpected T_STRING in C:\www\webroot\Email\conta ct_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?
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?
ASKER
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?
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?
You can remove it if you please. And; no, we just have to change the mail header adding this:
"Content-type:text/html;ch arset=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.
"Content-type:text/html;ch
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);
?>
Also, change the <br> to <br />.
ASKER
Now the email looks like:
Name<br />Phone Number<br />LongDescription<br />Location<br />DateNeeded<br />Department
Name<br />Phone Number<br />LongDescription<br />Location<br />DateNeeded<br />Department
Sorry, throw this in there too...
"MIME-Version: 1.0" . "\r\n";
"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);
ASKER
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;
I tried:
$body = "Requesters Name:" $requester . "<br>" . "Requester's Number" $phone . "<br>" . $desc . "<br>" . $loc . "<br>" . $cdate . "<br>" . $dept;
ASKER
By the way - it still has the <BR> in it
Did you change these tags to <br />
ASKER
I tried that too & it just shows <br /> in the text
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;
$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;
Maybe your host blocks HTML messages, who is your host?
ASKER
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;
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;
Try this instead of using <br />:
$body = "Requesters Name:" . $requester . \n . "Requester's Number" . $phone . \n . $desc . \n . $loc . \n . $cdate . \n . $dept;
$body = "Requesters Name:" . $requester . \n . "Requester's Number" . $phone . \n . $desc . \n . $loc . \n . $cdate . \n . $dept;
ASKER
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in C:\www\webroot\contact_pro cess.php on line 20
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;
$body = "Requesters Name:" . $requester . "\n" . "Requester's Number" . $phone . "\n" . $desc . "\n" . $loc . "\n" . $cdate . "\n" . $dept;
ASKER
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
Requesters Name:Your Name Requester's NumberPhone Number Description of work Location Date Needed Department
ASKER
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!
"Content-type: text/html;charset=iso-8859
Something like that, I just completely re-copied what you pasted above & it worked.
THANKS!
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;
$body = "Requesters Name:" . $requester . "\r\n" . "Requester's Number" . $phone . "\r\n" . $desc . "\r\n" . $loc . "\r\n" . $cdate . "\r\n" . $dept;
ASKER
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:"
$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:"
Don't mention it. Are you going to add JS validation now?
ASKER
What would the JS validation validate?
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;
$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;
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.
ASKER
It doesn't like the <strong> </strong>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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);
?>
ASKER
THANK YOU SOOO MUCH!
ASKER
Where would I throw the re-direct for the Thank you page? Right now it just goes to white.
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.
ASKER
Whatever is easiest...I just want it to go to a thankyou.html page instead of the blank page.
ASKER
Let me know if it is HTML or PHP & I can make a new question
Alright, make a new question for PHP and let me know where. It should be pretty simple to do...
sorry I get involved in this one.
ASKER
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.
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.
ASKER
NEvermind, I got it
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 . ")";
$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 . ")";
ASKER
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 ( )
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 ( )
So, the ticket system must not be reading the linebreaks. Could you try replacing the <br> tags with <br /> or "\r\n", please?