SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Thread: E-Mail Form

  1. #1
    SitePoint Member
    Join Date
    Feb 2002
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    E-Mail Form

    Hello. I am trying to set up a form to e-mail me in PHP, but it's not going too well. The address of the form is http://www.guitaretab.com/lessons/temp/feedbck.php . Here is the PHP I'm using...

    <HTML>
    <HEAD>
    <?php
    ob_start();
    ?>
    <TITLE>Online Guitar Lessons | Feedback</TITLE>
    <STYLE type=text/css>
    A { COLOR: "black"; FONT-FAMILY: arial; FONT-SIZE: 10pt; TEXT-DECORATION: none
    }
    TD,P,body {
    COLOR: "black"; FONT-FAMILY: verdana; FONT-SIZE: 10pt; TEXT-DECORATION: none
    }
    A:link { COLOR: "black"; FONT-FAMILY: verdana; FONT-SIZE: 10pt; TEXT-DECORATION: none
    }
    A:visited { COLOR: "black"; FONT-FAMILY: verdana; FONT-SIZE: 10pt; TEXT-DECORATION: none
    }
    A:hover { COLOR: "red"; FONT-FAMILY: verdana; FONT-SIZE: 10pt; TEXT-Decoration: none
    }
    </STYLE>

    </HEAD>
    <BODY>
    <CENTER>
    <img border=0 src="pictures/logo.gif" ALT="Online Guitar Lessons">
    <div align="center">
    <TABLE border=0 cellspacing="0" cellpadding="0">
    <td colspan="3" height="1" bgcolor="#000000"></td>
    <TR><TD width=1 bgcolor="black"></TD><TD bgcolor=#B3CC99 align="center"><font size="2">&nbsp;&nbsp;<?
    $melbdate = date("l, F d, Y",time() + $timeadjust);
    print ("$melbdate");
    ?>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="home.php" target="_top" onMouseover="window.status='Home Page'; return true" onMouseout="window.status=' '; return true">Home Page</a>&nbsp;&nbsp;&nbsp;<a href="lessons.php" target="_top" onMouseover="window.status='Guitar Lessons'; return true" onMouseout="window.status=' '; return true">Guitar Lessons</a>&nbsp;&nbsp;&nbsp;<a href="http://www.guitaretab.com/forum" target="_top" onMouseover="window.status='Message Board'; return true" onMouseout="window.status=' '; return true">Message Board</a>&nbsp;&nbsp;&nbsp;<a href="feedback.php" target="_top" onMouseover="window.status='Feedback'; return true" onMouseout="window.status=' '; return true">Feedback</a>&nbsp;&nbsp;</TD><TD width=1 bgcolor="black"></TD></TR>
    <TR><td colspan="3" height="1" bgcolor="#000000"></td></TR>
    <TR><TD width=1 bgcolor="black"></TD><TD bgcolor=#CC9999 align="center"><font size="2">&nbsp;&nbsp;<a href="http://www.guitaretab.com/ihome.php" target="Resource Window" onMouseover="window.status='GuitareTAB.com'; return true" onMouseout="window.status=' '; return true">GuitareTAB.com</a>&nbsp;&nbsp;&nbsp;<a href="http://www.cyberfret.com/index.php" target="Resource Window" onMouseover="window.status='Cyberfret.com'; return true" onMouseout="window.status=' '; return true">Cyberfret.com</a>&nbsp;&nbsp;&nbsp;<a href="http://www.mxtabs.net" target="Resource Window" onMouseover="window.status='Mxtabs.net'; return true" onMouseout="window.status=' '; return true">Mxtabs.net</a>&nbsp;&nbsp;&nbsp;<a href="http://www.songsearch.net" target="Resource Window" onMouseover="window.status='SongSearch.net'; return true" onMouseout="window.status=' '; return true">SongSearch.net</a>&nbsp;&nbsp;&nbsp;<a href="http://www.olga.net" target="Resource Window" onMouseover="window.status='Olga.net'; return true" onMouseout="window.status=' '; return true">Olga.net</a>&nbsp;&nbsp;</TD><TD width=1 bgcolor="black"></TD></TR>
    <TR><td colspan="3" height="1" bgcolor="#000000"></td></TR>


    <TR><TD width=1 bgcolor="black"></TD><TD bgcolor=#CCCC99 align="center"><font size="2">
    <TABLE border=0>
    <TD><TABLE border=0 cellspacing=0 cellpadding=0>
    <TD></TD>
    <TR><TD></TD></TR>
    <TR><TD></TD></TR>
    <TR><td colspan="3" height="1" bgcolor="#000000"></td></TR>
    <TR><TD width=1 bgcolor="#000000"></TD><TD bgcolor=#F1F1F1 align="center">&nbsp;&nbsp;Feedback&nbsp;&nbsp;</TD><TD width=1 bgcolor="#000000"></TD></TR>
    <TR><td colspan="3" height="1" bgcolor="#000000"></td></TR>
    <TR><TD width=1 bgcolor="#000000"></TD><TD width=450 bgcolor="white" align="center" valign="middle" bgcolor="white"><p><div align="left">
    <?
    if ( $sender_name && $message ) {
    $msg = "Sender's Full Name:\t$sender_name\n".
    "Sender's E-Mail:\t$email\n".
    "Additional Message:\t$message\n\n";

    $mailheaders = "From: LyricsFreak\n".
    "Reply-To: $email\n\n";

    mail("rich_bagnall@hotmail.com", "Feedback Form", $msg, $mailheaders);

    header("Location: http://www.guitaretab.com/lessons/temp/home.php");
    exit;
    }
    ?>
    <form method="POST" value="<?=$PHP_SELF?>">
    <input name="sender_name" type="text" size="55" style="font-family:verdana; background-color:#FFFFFF; color:#000000; font-size:10;">
    <input name="email" type="text" size="55" style="font-family:verdana; background-color:#FFFFFF; color:#000000; font-size:10;">
    <textarea name="message" cols=54 rows=5 style="font-family:verdana; background-color:#FFFFFF; color:#000000; font-size:10;"></textarea>
    <input name="submit" type="submit" value="Send This Form" style="font-family:verdana; background-color:#F8FFE1; color:#000000; font-size:10;">
    </TD><TD width=1 bgcolor="#000000"></TD></TR>
    <TR><td colspan="3" height="1" bgcolor="#000000"></td></TR>
    <TR><TD></TD></TR>
    <TR><TD></TD></TR>
    <TR><TD></TD></TR>
    </TABLE></TD>
    </TABLE>
    </TD>
    <TD width=1 bgcolor="black"></TD></TR>
    <TR><td colspan="3" height="1" bgcolor="#000000"></td></TR>
    <TR><TD width=1 bgcolor="black"></TD><TD bgcolor=#8C8C8C align="right"><font size="2">&nbsp;&nbsp;<i><font color="white">http://www.guitaretab.com/lessons - Last Updated : 13/02/02&nbsp;&nbsp;</TD><TD width=1 bgcolor="black"></TD></TR>
    <TR><td colspan="3" height="1" bgcolor="#000000"></td></TR>
    </TABLE>
    </BODY>
    <?php
    ob_end_flush();
    ?>
    </HTML>

    I hope you can find the important stuff out of all that. When you click submit, I want it to take you back to my home page (home.php) but when you click submit, it says...

    Warning: Cannot add header information - headers already sent by (output started at /home/web/musicfringe/guitaretab/lessons/temp/feedback.php:3) in /home/web/musicfringe/guitaretab/lessons/temp/feedback.php on line 58

    Any feedback would be greatly appretiated. Thank very much.

  2. #2
    SitePoint Guru
    Join Date
    Jan 2001
    Location
    Alkmaar, Netherlands
    Posts
    710
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you cannot print header after you send data to browser
    so if you wanna print header then you should make it sure you havent send any data to browser
    PHP Code:
    header("Location: [url]http://www.guitaretab.com/lessons/temp/home.php[/url]"); 
    Last edited by sylow; Feb 14, 2002 at 10:23.

  3. #3
    SitePoint Member
    Join Date
    Feb 2002
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't quite get what you mean. Do I use that PHP you gave me, or is that what I can't use?

  4. #4
    purple monkey dishwasher scoates's Avatar
    Join Date
    Nov 2001
    Location
    Montreal
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wish someone would fix vbulletin to NOT parse URLs between {php} blocks.

    S

  5. #5
    SitePoint Member
    Join Date
    Feb 2002
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Bye the way guys, I'm pretty sure it's this that is messing everyting up:

    header("Location: "http://www.guitaretab.com/lessons/temp/home.php");

  6. #6
    purple monkey dishwasher scoates's Avatar
    Join Date
    Nov 2001
    Location
    Montreal
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can't send a header after outputting data to the browser.

    Send the location header first, or use javascript (location.href='url').

    http://php.net/header

    S

  7. #7
    SitePoint Member
    Join Date
    Feb 2002
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •