Web Design Forum  
 
Go Back   Web Design Forum > Web and Graphic Design > Web Design

Reply
 
LinkBack Thread Tools Display Modes
Old 08-20-2008, 04:23 PM   #1 (permalink)
New Member
 
Join Date: Jul 2008
Posts: 12
Default Server Side scripts with regards to submitting form info

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?
Attached Files
File Type: txt form scripts.txt (4.5 KB, 31 views)
aviaf is offline   Reply With Quote
Old 08-20-2008, 05:51 PM   #2 (permalink)
joe
Bronze Member
 
Join Date: Aug 2008
Location: Dallas, Tx
Posts: 83
Default

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>
joe is offline   Reply With Quote
Old 08-20-2008, 07:27 PM   #3 (permalink)
New Member
 
Join Date: Jul 2008
Posts: 12
Default

thanks a bunch, i think i can fix it and figure any problems out from here on
aviaf is offline   Reply With Quote
Old 08-21-2008, 12:19 AM   #4 (permalink)
New Member
 
Join Date: Jul 2008
Posts: 12
Default

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
Attached Files
File Type: txt form scripts2.txt (3.4 KB, 24 views)
aviaf is offline   Reply With Quote
Old 08-21-2008, 12:39 AM   #5 (permalink)
joe
Bronze Member
 
Join Date: Aug 2008
Location: Dallas, Tx
Posts: 83
Default

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:

Quote:
PHP:

<?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" ;

$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>
joe is offline   Reply With Quote
Old 08-21-2008, 12:58 AM   #6 (permalink)
New Member
 
Join Date: Jul 2008
Posts: 12
Default

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
aviaf is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 04:00 AM.


Computer Forum - TechZine - Webpage Design

 
Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.