egoche 15 Newbie Poster

rproffitt,

Thanks for the response. Apologies for not clarifying the first two statements. Let me try this again.

I have an HTML form that, when the Submit button is clicked, an email is sent using PHP. The code below successfully sends an email to multiple addresses...two addresses in the TO field, one address in the CC field and one address in the BCC field:

$to = "ADDRESS1, ADDRESS2 \r\n";
$headers .= "CC: ADDRESS3 \r\n";
$headers .= "BCC: ADDRESS4 \r\n";

When the email is received, the code below successfully adds one or more addresses in the TO field automatically:

$headers .= "Reply-To: ADDRESS5, ADDRESS6 \r\n";

I know the codes above work because I've tested them multiple times. The problem is that I want to not only automatically put addresses in the TO field, I want to put addresses in the CC & BCC fields. I've tried...

$headers .= "Reply-To: ADDRESS5 \r\n";
$headers .= "Reply-CC: ADDRESS6\r\n";
$headers .= "Reply-BCC: ADDRESS7\r\n";

...and I've tried...

$headers .= "Reply-To: ADDRESS5 \r\n";
$headers .= "CC: ADDRESS6\r\n";
$headers .= "BCC: ADDRESS7\r\n";

...but neither option works. Is is possible to automatically add addresses to the CC and/or BCC fields automatically using the Reply-To command in PHP?

Eric

rproffitt commented: Before you test with PHP you test by manually sending that email. Some folk won't do this. +15
egoche 15 Newbie Poster

I know that the code to send an email to multiple addresses is:

$to = "ADDRESS1, ADDRESS2 \r\n";
$headers .= "CC: ADDRESS3 \r\n";
$headers .= "BCC: ADDRESS4 \r\n";

And I know that you can add a reply-to address with:

$headers .= "Reply-To: ADDRESS5, ADDRESS6 \r\n";

My question is...what code to use for the reply-to fields so that you can add a CC and BCC. I've tried:

$headers .= "Reply-To: ADDRESS5 \r\n";
$headers .= "Reply-CC: ADDRESS6\r\n";
$headers .= "Reply-BCC: ADDRESS7\r\n";

And I've tried:

$headers .= "Reply-To: ADDRESS5 \r\n";
$headers .= "CC: ADDRESS6\r\n";
$headers .= "BCC: ADDRESS7\r\n";

Nothing's worked so far. Any thoughts?

Eric

egoche 15 Newbie Poster

Looking for assistance in, as the title reads, accessing an Access database via PHP when the database is open. (Please bear with me as my knowledge of PHP, when used in conjunction with a database, is extremely sketchy at best.)

Using the code below, I can pull up a directory of employees. It's nothing fancy but it works and I'm still learning:

$conn=odbc_connect('Employees','','');
if (!$conn)
  {exit("Connection Failed: " . $conn);}

$sql="SELECT * FROM tblEmployees WHERE CompanyID = '$comp' AND Active = Yes AND Generic = No ORDER BY LastName";
$rs=odbc_exec($conn,$sql);
if (!$rs)
  {exit("Error in SQL");}
echo "<table>";
echo "<tr><th>Name</th>";
echo "<th>Department</th>";
echo "<th>Email Address</th></tr>";
while (odbc_fetch_row($rs))
  {
  $compdept=odbc_result($rs,"Dept");
  $empfirst=odbc_result($rs,"FirstName");
  $emplast=odbc_result($rs,"LastName");
  $empemail=odbc_result($rs,"ECAddress1");
  echo "<tr><td>$emplast, $empfirst</td>";
  echo "<td>$compdept</td>";
  echo "<td>$empemail</td></tr>";
  }
odbc_close($conn);
echo "</table>";

?>

The problem is that when someone has the database open on their computer, the connection fails.

There are a number of possible reasons that come to mind, but I was hoping that someone would be able to point out something I'm missing.

Eric

egoche 15 Newbie Poster

fxm...thanks for the tip!

egoche 15 Newbie Poster

Is it possible to change the CSS class of an entire table row using JavaScript?

egoche 15 Newbie Poster

I've never used AJAX but I think I'll start looking at it. Thanks.

egoche 15 Newbie Poster

Not sure if I'm in the correct forum but...

I have a form with three select boxes. Box 1 has a variety of choices, but boxes 2 & 3 are empty. When the person selects an option from box 1, box 2 gets populated with choices. When the person selects an option from box 2, box 3 gets populated with choices.

This is handled with javascript through either onblur or onchange (still working on which will work best for this).

The problem occurs after pressing submitting the form and then pressing the back button. All fields maintain their data EXCEPT boxes 2 & 3.

How do I get it so that those two boxes keep the data like the rest of the form?

egoche 15 Newbie Poster

I have some additional questions but they don't pertain to this particular topic so I'll start a new one.

In the meantime I'll use default answers as a quick means of avoiding errors.

Thanks to both for the info...

egoche 15 Newbie Poster

almostbob...thanks for the response. Can you clarify a couple things?

What is the reason for the 'label' tag?.

Also, what is the difference between an 'id' and a 'name'?

egoche 15 Newbie Poster

I don't have any items set with an index. Probably not the best idea but I'm pretty new to PHP and not confident about when an index is required.

The form consist of a basic table where all user input is coded similarly to:

<td> <input type=radio value=No name="manager"> No <input type=radio value=Yes name="manager"> Yes </td>

Upon clicking the Submit button where the code for the above field is:

$manager = $_POST["manager"];

If the user skips the option in the form, the error message in my earlier post gets displayed in the browser. I've added an if/then statement that will no longer display the error, but I was hoping to come across a straightforward piece of validation code. (Unlikely to be simple, but I can dream.)

The type of validation code I'm looking for would occur when clicking the submit button; if some data has not been entered, the a yes/no dialog box would appear asking if the user wants to add more information. If the user declines, the code would process without the aforementioned errors. If the user agrees, the dialog box would close and the form would still be on the screen with all previously entered data intact.

That's not too much to ask...right? :icon_biggrin:

egoche 15 Newbie Poster

Some of the fields in a form are desired but not required. As a result of these fields being left alone, PHP will return errors similar to:

"Notice: Undefined index: manager in C:\wamp\www\form.php on line 12".

My current question is how do you tell PHP to disregard a field if it's empty? I don't know if this makes a difference but the form has text fields, checkboxes & radio buttons.

egoche 15 Newbie Poster

Whatever the reason, it doesn't last long...it's working again. Go figure.

egoche 15 Newbie Poster

After happily working on the form for the last hour or so, PHP decided to stop working.

Again, no error codes...it just looks like the PHP is processing the code, shows 'Done' in the IE Status Bar and that's it. No display of data...no email.

egoche 15 Newbie Poster

It's working now...and nothing was done.

I went to lunch and when I got back I did as you suggested. When I ran it, I got a large amount of PHP info (version number, System, Build Date, Compiler, etc.). I then tried the file I was working on earlier and it worked.

Before I left for lunch...it didn't work. After I got back...it worked. I don't get it.

Going back to your comment about the "white screen of death"...I'm not sure. Let me explain a bit about how I've got things set up and maybe you'll realize what part of the equation I'm missing.

The company I work for has multiple locations and uses a Domain environment. I use two computers...one with XP and the other with Windows 7. (The XP is used primarily for testing purposes.) I felt it would be beneficial to utilize HTML & PHP to replace some of the forms being use and, after a bit, decided to utilize WAMP.

I downloaded and installed the most current version on the XP machine. As mentioned previously, I used mostly default settings except where the mail server settings are concerned. (One of my goals was to get away from having HTML forms be dependent upon the email client on the individual computers.)

After a quick set up, I placed the WampServer online. From the Windows 7 computer I can now open an IE browser, open the HTML form and, after clicking the …

egoche 15 Newbie Poster

Thanks for the quick response.

When I first installed everything, I just basically used default settings and thought that by putting it 'online' that would be all I needed to do. But from what I'm now reading, I'll need to make some modifications to one or more files. That being said...

I looked at the php.ini file and it appears to be set to display all errors. The error options I see are:

error_reporting = E_ALL
display_errors = On
display_startup_errors = On
log_errors = On
track_errors = On
html_errors = On

The above was copied directly from the php.ini file.

egoche 15 Newbie Poster

Please bear with me as I'm new to PHP.

Yesterday, I was working on an HTML form and everything was working fine (PHP would process the information and send an email as expected), but when I started this morning nothing happens.

A couple weeks ago I installed WAMP using mostly default settings. The only thing I modified was the information about email (server info, etc.), and that was done during the installation. After the installation, I used a basic, test form and was pleased to find the PHP working as expected. I then started working on my own form and it also worked as expected. The next day it stopped...I didn't change ANYthing, but it stopped working. No errors...just nothing. The following day it worked; again, no changes...it just started working again.

I've now been working on the form for a few days...everything's been working fine until this morning. I tried the form and nothing happened. As before there were no errors.

As I mentioned above, I'm new to PHP so I have absolutely no idea what to look for in determining the problem. Can someone give me any ideas on where to look?