Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Using Form and php script to send email
Old 08-20-2008, 09:04 PM Using Form and php script to send email
Junior Talker

Posts: 4
Trades: 0
Ok, so I have a form for contact us at:

www.corradocomputers.com/feedback.html

and its fine but i used a site's wizard to create it and the php sever side script. Now I want to create another form on the error page, see it by going to:

www.corradocomputers.com/anypage.html

but i dont know what to do in the new php script for it. I tried to go through the one that I have and change it to fit my needs but I get:

Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE or '$' in /homepages/42/d251459630/htdocs/notfound.php on line 55.

Here is my coding:

Code:
PHP coding under filename: 'notfound.php' :

(1) <?php
/*
    

*/

// ------------- CONFIGURABLE SECTION ------------------------

// $mailto - set to the email address you want the form
// sent to, eg
//$mailto        = "youremailaddress@example.com" ;

$mailto = 'corrado.cioci@gmail.com' ;

// $subject - set to the Subject line of the email, eg
//$subject    = "Broken Link Form" ;

$subject = "Broken Link Form" ;

// the pages to be displayed, eg
//$formurl        = "http://www.example.com/error404.html" ;
//$errorurl        = "http://www.example.com/error.html" ;
//$thankyouurl    = "http://www.example.com/thankyou.html" ;

(25) $formurl = "http://www.corradocomputers.com/error404.html" ;
$errorurl = "http://www.corradocomputers.com/error.html" ;
$thankyouurl = "http://www.corradocomputers.com/thankyou_broken_link.html" ;

$uself = 0;
$broken_link_url_is_required = 1;
$name_is_required = 1;
$use_utf8 = 1;

// -------------------- END OF CONFIGURABLE SECTION ---------------

$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
$content_type = (!isset( $use_utf8 ) || ($use_utf8 == 0)) ? 'Content-Type: text/plain; charset="iso-8859-1"' : 'Content-Type: text/plain; charset="utf-8"' ;
$name = $_POST['name'] ;
$broken_link_url = $_POST['brokenlink'] ;
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );

if (!isset($_POST['brokenlink'])) {
    header( "Location: $formurl" );
    exit ;
}
if (($email_is_required && (empty($email) || !ereg("@", $email))) || ($name_is_required && empty($name))) {
    header( "Location: $errorurl" );
    exit ;
}
(50) if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
    header( "Location: $errorurl" );
    exit ;
}
(55) if ($broken_link_url == "") { 
    $broken_link_url = $mailto ;
}

if (get_magic_quotes_gpc()) {
    $comments = stripslashes( $comments );
}

$messageproper =

    "This message was sent from:\n" .
    "$http_referrer\n" .
    "------------------------------------------------------------\n" .
    "Name of sender: $name\n" .
    "Broken Link/URL: $broken_link_url\n" .
    "------------------------- COMMENTS -------------------------\n\n" .
    $comments .
    "\n\n------------------------------------------------------------\n" ;

mail($mailto, $subject, $messageproper,
  (75) "From: \"$name\" <$broken_link_url>" . $headersep . "Reply-To: \"$name\" <$broken_link_url>" . $headersep . "X-Mailer: chfeedback.php 2.11.0" .
    $headersep . 'MIME-Version: 1.0' . $headersep . $content_type );
header( "Location: $thankyouurl" );
exit ;

(80) ?>

**********
**********
**********

Html scripting in: 'error404.html' :

<form action="notfound.php" method="post">
    <p class="style10">The page you are looking for is not available.</p>
    <p class="style10">Please help us correct this problem by filling out the form below:</p>
     <table border="0" align="center" cellpadding="8" cellspacing="8" summary="brokenlink form">
      <tr>
        <td width="132">Name:</td>
        <td width="401"><input type="text" name="name" size="65" /></td>
      </tr>
      <tr>
        <td>Current URL:</td>
        <td><input type="text" name="brokenlink" size="65" /></td>
      </tr>
      <tr>
        <td colspan="2"> Comments (How did you get here?):<br />
            <br />
            <textarea rows="5" cols="69" name="comments"></textarea>
        </td>
      </tr>
      <tr>
        <td align="center" colspan="2"><input type="submit" value="Send Feedback" />
            <br />
        </td>
      </tr>
    </table>
    </form>
You can view it at http://www.corradocomputers.com/anypage.html

Last edited by avuaf; 08-21-2008 at 10:24 AM..
avuaf is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-21-2008, 02:54 AM Re: Using Form and php script to send email
Average Talker

Posts: 17
Name: Chris
Trades: 0
hmm.. the link takes me nowhere.. do you think you can post the line #'s are well next to each line/
xpiamchris is offline
Reply With Quote
View Public Profile
 
Old 08-21-2008, 06:46 AM Re: Using Form and php script to send email
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
Do not use bare mail() function, use phpmailer class instead
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 08-21-2008, 10:25 AM Re: Using Form and php script to send email
Junior Talker

Posts: 4
Trades: 0
ok, i put numbers at 25 intervals in brakcets, sry. and i fixed the link, i forgot an s , :P
avuaf is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Using Form and php script to send email
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.27887 seconds with 12 queries