logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > PHP
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 11-18-2011, 08:31 PM   #1
ErektheBug
 
Join Date: Nov 2011
Posts: 4
Default Help with PHP code fir sending form content

I went to the tutorial section of Dreamweaver Club to create a simple form on my HTML page for visitors to submit their e-mail address and have it e-mailed to me. The instructions seemed simple enough, but when I test it, I get the following errors:


Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /data/9/2/98/105/2587268/user/2837067/htdocs/sendresults.php on line 8

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /data/9/2/98/105/2587268/user/2837067/htdocs/sendresults.php on line 10

Parse error: syntax error, unexpected T_VARIABLE in /data/9/2/98/105/2587268/user/2837067/htdocs/sendresults.php on line 12

I'm not a coder...I'm a designer. The author is no longer available...can somebody help, please...?
ErektheBug is offline   Reply With Quote
Old 11-18-2011, 11:25 PM   #2
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,164
Default

it looks like a server problem from the path not the form perhaps
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 11-19-2011, 01:19 AM   #3
ErektheBug
 
Join Date: Nov 2011
Posts: 4
Default

Quote:
Originally Posted by edbr View Post
it looks like a server problem from the path not the form perhaps
So, I re-did this, and uploaded it...now when I hit 'submit' it opens the page with the php code instead of going to the "confirmation" page...and I don't get an e-mail with the info....
ErektheBug is offline   Reply With Quote
Old 11-19-2011, 01:38 AM   #4
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,164
Default

post the code form and php
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 11-19-2011, 04:25 PM   #5
ErektheBug
 
Join Date: Nov 2011
Posts: 4
Default

You can see the form at www.ccbf.us/indexbeta.html, and here's the php code I'm using:


<?php
//--------------------------Set these paramaters--------------------------

// Subject of email sent to you.
$subject = 'Results from e-mail submission form';

// Your email address. This is where the form information will be sent.
$emailadd = 'erek@erekthebug.com';

// Where to redirect after form is processed.
$url = 'http://www.ccbf.us/confirmation.html';

// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '0';

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>
ErektheBug is offline   Reply With Quote
Old 11-19-2011, 10:32 PM   #6
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,164
Default

when i go to your site and submit I can read the php file. its showing <p>&lt;?php<br /> not <?php and ?&gt;</p> instead of ?>. change this in code view, you can loose the <p> tags .
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr 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

Forum Jump


All times are GMT. The time now is 11:01 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com