Jump to content

SeanH228

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

SeanH228's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. This PHP script work exactly as it should sending the email to the appropriate email address defined in it and displaying the correct web page upon a successful submit. Right now if I go throught the process the email sent is from oceans@aimtree.org and it is sent to oceans@aimtree.org. I would like to know if someone can help me with resolving where the from is being pulled from. At the bottom of my form I have a required field for contact information in the form of an email address. I would like that field to somehow display that it is from that entry this way when the user oceans@aimtree.org receives the email they can know who it is from and reply back to it. I don't know what code is needed if any at all to make this happen. I hope this makes sense to all of you. Thanking you in advance Here is the script <?php //--------------------------Set these paramaters-------------------------- // Subject of email sent to you. $subject = 'Residential Repair Request'; // Your email address. This is where the form information will be sent. $emailadd = 'oceans@aimtree.org'; // Where to redirect after form is processed. $url = 'http://www.aimtree.org/pwthankyou.htm'; // 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.'">'; ?>
  2. [!--quoteo(post=374758:date=May 17 2006, 03:06 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ May 17 2006, 03:06 PM) [snapback]374758[/snapback][/div][div class=\'quotemain\'][!--quotec--] I suspect you need to compare the length of [b]$value[/b] rather than $key. [/quote] changed the $j variable to equal 50 instead of 20 seemed to work I also changed all related variables with the =20 entry to 50 and the script now at least appears to work. My thank you page for submitting the form displays in my browser the only thing that doesn't work now is the email. Do you ave any idea how to set this up? Is this a setting in PHP or on my webserver somewhere? My webserver resides in our DMZ and the email server is on the inside LAN. Thanks Andy for opening my eye to the $value variable.
  3. [!--quoteo(post=374711:date=May 17 2006, 12:24 PM:name=SeanH228)--][div class=\'quotetop\']QUOTE(SeanH228 @ May 17 2006, 12:24 PM) [snapback]374711[/snapback][/div][div class=\'quotemain\'][!--quotec--] The file is saved as a .php file I just don't know why it won't execute [/quote] OK I have rechecked the syntax in the script and I found that I was missing a space after the php tag . I noticed this because as I combed through each line I noticed that there was a space afer each line of code. Now the script seems to run but I am getting this when I click on the Submit button of my form "Name of form element location_description cannot be longer than 20 characters" Any help please advise
  4. [!--quoteo(post=374703:date=May 17 2006, 12:13 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ May 17 2006, 12:13 PM) [snapback]374703[/snapback][/div][div class=\'quotemain\'][!--quotec--] Make sure you are saving your files with a [b].php[/b] extension and not anyother extension! Such as .html [/quote] The file is saved as a .php file I just don't know why it won't execute
  5. Hello everyone, I having problems with a script executing properly on my IIS 6 Webserver. PHP is installed manually as recommended from [a href=\"http://www.php.net\" target=\"_blank\"]http://www.php.net[/a] and I have followed the directions on moving the PHP files to the correct directories and adding the Web Server extensions. The problem is this. Our Webmaster createda form using dreamweaver and is trying to use this PHP script to execute the options set forth in the script. Here is the script in question <?php //--------------------------Set these paramaters-------------------------- // Subject of email sent to you. $subject = 'Residential Repair Request'; // Your email address. This is where the form information will be sent. $emailadd = 'oceans@aimtree.org'; // Where to redirect after form is processed. $url = 'http://www.aimtree.org/pwthankyou.htm'; // 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.'">'; ?> Evertime we go to use the Submit function of this form it produces this same code in the browser. This tells me the script is not executing but I don't know why. The phpinfo() files executes correctly on the server and I can see all the configuration settings as it says I should. Don't know if everything is correct in the php.ini file though. I am gasping for help here as I need to get these forms working by a deadline. Any help in this matter is greatly appreciated. Thanking you in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.