Server Side scripts with regards to submitting form info

aviaf

New Member
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, but Im unsure of how to make it respond to this specific form and how to make it work.

I;ve attached the php script and the scripting of the form on the feedback page.

Can someone explain how I would write a new script to go with the form on the error page?
 

Attachments

  • form scripts.txt
    4.5 KB · Views: 99

joe

New Member
The problem is not the php, it's your html. You're missing the form tags. On your anypage.html, you are missing: <form action="feedback.php" method="post"> and then the closing tag </form>
 

aviaf

New Member
ok i lied, im a total idiot, help.

i attached the new php script and html part (i basically took another premade form and script and tried to change it to what i needed)

when i try to use it, it says:

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

thx in advance
 

Attachments

  • form scripts2.txt
    3.4 KB · Views: 73

joe

New Member
In your html you have current url set to name=brokenlink and then in your php you are requesting broken link url from POST. so in your php you need to change it to brokenlink. Try this:

PHP:

<?php
/*


*/

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

// $mailto - set to the email address you want the form
// sent to, eg
//$mailto = "[email protected]" ;

$mailto = '[email protected]' ;

// $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" ;

$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 ;
}
if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
header( "Location: $errorurl" );
exit ;
}
if (empty($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,
"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 ;

?>

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

Html scripting:

<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>
 

aviaf

New Member
i changed it but i still got:

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