Mail form- HELP!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

PanK
Forum Commoner
Posts: 36
Joined: Mon Nov 22, 2004 1:24 pm
Location: Richmond Hill, ON, Canada

Post by PanK »

Show the script you currently have(not the script i gave you), then we will be able to help you.
eblumrich
Forum Newbie
Posts: 11
Joined: Wed Nov 24, 2004 1:29 pm

Okay- thanks- I didn't know that was the script you wanted.

Post by eblumrich »

The following is the PHP:

Code: Select all

<?php
$myemail = "governor@governorgirlieman.com";
?>
<style type="text/css">
<!--
.style1 &#123;
	font-family: Arial, Helvetica, sans-serif;
	font-weight: bold;
&#125;
.style2 &#123;color: #990033&#125;
body &#123;
	background-color: #ff99ff;
&#125;
-->
</style>
 

<table width="400"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td width=400 height=400 ><p align="center" class="style1"><span class="style2">Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> ) <br>
  For sending : <a href="<?php echo $urlis ?>"> <?php echo $sitename ?> </a> (link)<br>
  To: <?php echo $friend ?> (<?php echo $friendmail ?>) </span><br>
    </p>
            <div align="center"><span class="style1"><br>
                <a href="<?php echo $redirectlink ?>"> Next Page </a> </span><br>
              <?php
$ip = getenv("REMOTE_ADDR");
if (!isset($visitormail) || !isset($friendmail)) 
echo "<font size=6>You Goofed</font> $ip" ; 
$notes = stripcslashes($notes); $messageis = "
Your Friend: $visitor ($visitormail)\n
Sent this URL: $sitename ($urlis) \n
To: $friend $friendmail \n
With These Comments: $notes \n";

$messageme = $ip . " " . $messageis;

$from = "From: $myemail\r\n";

if ($myemail != "") 
mail($myemail, $sitename, $messageme, $from);
if ($friendmail != "") 
mail($friendmail, $sitename, $messageis, $from);
if ($visitormail != "") 
mail($visitormail, $sitename, $messageis, $from);
?>
    </div></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>

The following is the HTML file it works with:

Code: Select all

<body bgcolor="#FF99FF">

<table width="600" height="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td background="mailbg.jpg" width=600 height=399><p align=center>
      <form method="POST" action="sendurl.php">

        <input type=hidden name="sitename" value="Governor Girle Man">
        <input type=hidden name="urlis" value="http://www.governorgirlieman.com">
        <input type=hidden name="redirectlink" value="page2.html">
        <img src="mailggm.gif" width="450" height="155">        
        <p align=center>Your Name:
            <input type=text name="visitor" size="25">
            <br>
    Your Email:
    <input type=text name="visitormail" size="25">
    <br>
    Friend's Name:
    <input type=text name="friend" size="25">
    <br>
    Friend's Email:
    <input type=text name="friendmail" size="25">
    <br>
    <textarea name=notes rows=4 cols=50>CHECK THIS OUT:  Arnold Schwartzenegger in a pink dress!</textarea>
    <br>
    <input type=submit value="Send URL">
    </form></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<P align=center>

</p>
PanK
Forum Commoner
Posts: 36
Joined: Mon Nov 22, 2004 1:24 pm
Location: Richmond Hill, ON, Canada

Post by PanK »

What is wrong with your code? I mean does it run, or it gives errors? OR just does not sent any email?
eblumrich
Forum Newbie
Posts: 11
Joined: Wed Nov 24, 2004 1:29 pm

As I stated...

Post by eblumrich »

Thank you for your reply.

The form works fine- both the HTML and PHP work FINE.

But:

When a website visitor uses this page to refer a friend, I want it to CC me. In other words:

when someone uses this page, it will send an e-mail to their friend, saying "hey- come and visit this site"- I want the PHP to automatically CC me a copy of that e-mail.

So that I get a copy of every e-mail sent via this form.

Shouldn't there just be a small tag one can add to the PHP that does this?

-Thank you for your time, and patience.
PanK
Forum Commoner
Posts: 36
Joined: Mon Nov 22, 2004 1:24 pm
Location: Richmond Hill, ON, Canada

Post by PanK »

Code: Select all

<?php
$to  = "mary@example.com" . ", " ; // note the comma
$to .= "kelly@example.com";


if ($myemail != "") 
{
  mail($myemail, $sitename, $messageme, $from); 
}
if ($friendmail != "") 
{
    $sentmailto= $friendmail.", ".$myemail;//should sent to two email addresses
    mail($sentmailto, $sitename, $messageis, $from); 
}
if ($visitormail != "") 
{
   $sentmailto= $visitormail.", ".$myemail;//should sent to two email addresses
   mail($sentmailto, $sitename, $messageis, $from); 
}
?>
eblumrich
Forum Newbie
Posts: 11
Joined: Wed Nov 24, 2004 1:29 pm

Uhh...

Post by eblumrich »

Okay...

Ya know-

I guess I'm ignorant- this is making no sense to me. "Note the comma"? Is that anything like "I am the walrus" or "Tube the Espous"?

Ya know, considering I've spent well onto 10 years working in web applications, HTML, multimedia, and such, I figured I could at least make some sense out of this, but everything just confounds the hell out of me, and I can't get something to work that SHOULD be a simple operation.

Thanks for your help, but I give up. I'm just gonna tell the client it can't be done.
Post Reply