Jump to content

Xelex

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Everything posted by Xelex

  1. I love you. So much. Haha, thanks a ton xD It worked, now I can finally move my files to the main server.
  2. I did some searching, but I can't seem to find the answer to my problem... I wrote a contact form in PHP, and on LunarPages servers, it runs just fine. However, when I try to run it on Yahoo servers, I get an error, though it doesn't give me a reason. I'm assuming it's because Yahoo has a safeguard in place to prevent people from spamming through contact forms. But my question is, how do I make a PHP script send an email from my domain's email address? Here's my script at present: <?php if (isset($_POST["email"])) { $ToEmail = '***********.com' . ', '; $ToEmail .= '**********.com'; $EmailSubject = 'Site Contact Form '; $mailheader = "From: ".$_POST["email"]."\r\n"; $mailheader .= "Reply-To: ".$_POST["email"]."\r\n"; $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n"; $MESSAGE_BODY = "\nFirst Name: ".$_POST["name"]."<br>"; $MESSAGE_BODY .= "\nLast Name: ".$_POST["name2"]."<br>"; $MESSAGE_BODY .= "\nAffilliation/Convention: ".$_POST["name3"]."<br>"; $MESSAGE_BODY .= "\nHome Phone Number: ".$_POST["name4"]."<br>"; $MESSAGE_BODY .= "\nCell Phone Number: ".$_POST["name5"]."<br>"; $MESSAGE_BODY .= "\nWork Phone Number: ".$_POST["name6"]."<br>"; $MESSAGE_BODY .= "\nDates for Rental: ".$_POST["name7"]."<br>"; $MESSAGE_BODY .= "\nType of Equipment: ".$_POST["FieldData"]."<br>"; $MESSAGE_BODY .= "\nEmail Address: ".$_POST["email"]."<br>"; $MESSAGE_BODY .= "\nAdditional Comments: ".nl2br($_POST["comment"])."<br>"; mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure. Again!"); ?> <b>Your message was sent to one of our representatives, and will be reviewed. We look forward to contacting you in the near future, thank you.</b> <?php } else { ?> Once again, it works just fine on Lunarpages, (When I get the email, it comes straight from the lunar pages server) but does not on yahoo. I set up an email address for use with PHP/Perl through yahoo, but I don't know a function to get it to send it through that domain. I even checked out the PHP documentation on the mail function. I figure there HAS to be a way, seeing how I'm pretty sure such a method is in high demand.... Thanks. EDIT: Disregard, it comes from an UNKNOWN SENDER.... Now I'm almost positive that that is the reason why Yahoo does not let it work.
  3. I feel stupid now, thank you.
  4. I'm trying to create an RSS feed that dynamically updates in PHP... And I've managed to create a few question... When I try to run the script, I get this error: Warning: Cannot modify header information - headers already sent by (output started at /home/******/rss1.php:9) in /home/****/*****/****/rss1.php on line 48/promo.rss?promoid=1707&token=cd0bad28f52a7bf7b509e751915d72f57dfdb35c5f7eedb50176437a5c2881a2Sun, 10 Feb 2008 22:11:00 -0800 ( Starred out file paths for security ) Here is the code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>RSS Feed</title> </head> <body> <?php /** * Work on a database to store this information. */ $channel = array("title" => "RSS Feeds", "description" => "RSS Feed Example", "link" => "*******", "copyright" => "Copyright NA"); $items = array( array("title" => "EB Games", "description" => "Stuff on EB Games", "link" => "**********", "pubDate" => date("D, d M Y H:i:s O", mktime(22, 11, 0, 1, 41, 2008))) , array("title" => "Hotwire Hotel", "description" => "Hotwire Deals", "link" => "********", "pubDate" => date("D, d M Y H:i:s O", mktime(22, 11, 0, 1, 41, 2008))) ); $output = '<?xml version="1.0" encoding="ISO-8859-1"?>'; $output .= '<rss version="2.0">'; $output .= "<channel>"; $output .= "<title>" . $channel["title"] . "</title>"; $output .= "<description>" . $channel["description"] . "</description>"; $output .= "<link>" . $channel["link"] . "</link>"; $output .= "<copyright>" . $channel["copyright"] . "</copyright>"; foreach ($items as $item) { $output .= "<item>"; $output .= "<title>" . $item["title"] . "</title>"; $output .= "<description>" . $item["description"] . "</description>"; $output .= "<link>" . $item["link"] . "</link>"; $output .= "<pubDate>" . $item["pubDate"] . "</pubDate>"; $output .= "</item>"; } $output .= "</channel>"; $output .= "</rss>"; header("Content-Type: application/rss+xml; charset=ISO-8859-1"); echo $output; ?> </body> </html> Also, the information that shows up in the variables, such as the link and description show up on the page AFTER the error, as in as regular text right next to the error as if I loaded up an HTML file with only text. I'm guessing it's probably a stupid mistake, or I don't have my server configured properly.... Also, I'm not quite sure how RSS parses out information... Have any sources that explains what it does to pull and display it's information/title? You guys have been very helpful, thank you, by the way =)
  5. Ok, so I've got a form to work thanks to the help of this community, and I've noticed a few minor problems... First off, I noticed that if a person doesn't fill in all the forms, it will fail to submit. Why is that? And finally, I have a comment text area, and if it exceeds a certain amount of characters, it will give you a success screen even though the email is never really sent. Is there a reason why? And if so, is it due to the script or the client? EDIT: Disregard; \n is an amazing thing. But how do I allow my script to omit fields if they enter nothing in there? As in, instead of failing to process if they leave a field blank, to go ahead and process anyways? Here's the script: <?php if ($_POST["email"]<>'') { $ToEmail = '**********@hotmail.com' . ', '; $ToEmail .= '******@gmail.com'; $EmailSubject = 'Site contact form '; $mailheader = "From: ".$_POST["email"]."\r\n"; $mailheader .= "Reply-To: ".$_POST["email"]."\r\n"; $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n"; $MESSAGE_BODY = "\nFirst Name: ".$_POST["name"]."<br>"; $MESSAGE_BODY .= "\nLast Name: ".$_POST["name2"]."<br>"; $MESSAGE_BODY .= "\nAffilliation/Convention: ".$_POST["name3"]."<br>"; $MESSAGE_BODY .= "\nHome Phone Number: ".$_POST["name4"]."<br>"; $MESSAGE_BODY .= "\nCell Phone Number: ".$_POST["name5"]."<br>"; $MESSAGE_BODY .= "\nWork Phone Number: ".$_POST["name6"]."<br>"; $MESSAGE_BODY .= "\nDates for Rental: ".$_POST["name7"]."<br>"; $MESSAGE_BODY .= "\nType of Equipment: ".$_POST["FieldData"]."<br>"; $MESSAGE_BODY .= "\nEmail Address: ".$_POST["email"]."<br>"; $MESSAGE_BODY .= "\nAdditional Comments: ".nl2br($_POST["comment"])."<br>"; mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure. Again!"); ?> <b>Your message was sent to one of our representatives, and will be reviewed. We look forward to contacting you in the near future, thank you.</b> <?php } else { ?> <form action="contact_us_test.php" method="post"> <table width="400" border="0" cellspacing="2" cellpadding="0"> <tr> <td width="29%" class="bodytext">First name:</td> <td width="71%"><input name="name" type="text" id="name" size="32"></td> </tr> <tr> <td width="29%" class="bodytext">Last name:</td> <td width="71%"><input name="name2" type="text" id="name" size="32"></td> </tr> <td width="29%" class="bodytext">Affiliation/Convention:</td> <td width="71%"><input name="name3" type="text" id="name" size="32"></td> </tr> <tr> <td class="bodytext">Customer Home Number:</td> <td><input name="name4" type="text" id="name" size="32"></td> </tr> <tr> <td width="29%" class="bodytext">Customer Cell Number:</td> <td width="71%"><input name="name5" type="text" id="name" size="32"></td> </tr> <tr> <td width="29%" class="bodytext">Customer Work Number:</td> <td width="71%"><input name="name6" type="text" id="name" size="32"></td> </tr> <tr> <td width="29%" class="bodytext">Dates for Rental:</td> <td width="71%"><input name="name7" type="text" id="name" size="32"></td> </tr> <tr> <td class="bodytext">Email address:</td> <td><input name="email" type="text" id="email" size="32"></td> </tr> <tr> <td nowrap="nowrap"><span class="style19"><font face="Verdana" color="#000000">Type of Equipment Needed</font></span></td> <td><select name="FieldData"> <option value="Power Wheelchair">Power Wheelchair</option> <option value="Power Scooter">Power Scooter</option> <option value="Other">Other</option> </select> </td> </tr> <tr> <td class="bodytext">Comment:</td> <td><textarea name="comment" cols="45" rows="6" id="comment" class="bodytext"></textarea></td> </tr> <tr> <td class="bodytext"> </td> <td align="left" valign="top"><input type="submit" name="Submit" value="Send"></td> </tr> </table> </form> <?php }; ?>
  6. Thank you a TON for the help... I got it working =)
  7. It doesn't actually give me a code error, it just says failure. And I think I know what you mean by overwriting my value, out of laziness I didn't rewrite the input call, I just copy pasted the same line over and over again... So I take it I should change the id names to something else and then repost them under their respect names in the top line of code? Also, thanks a lot for the fast responses guys, I really appreciate having you alleviate my stupidity xD Sorry about the code tags, it's been a while since I've actually posted on a programming forum =\.
  8. I'm currently developing a contact form for a business and I've ran into a bit of a problem.... I wrote this script: <?php if ($_POST["email"]<>'') { $ToEmail = '[email protected]'; $EmailSubject = 'Ready Rental Contact Form'; $mailheader = "From: ".$_POST["[email protected]"]."\r\n"; $mailheader .= "Reply-To: ".$_POST["[email protected]"]."\r\n"; $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n"; $MESSAGE_BODY = "Name: ".$_POST["name"]."<br>"; $MESSAGE_BODY .= "Email: ".$_POST["email"]."<br>"; $MESSAGE_BODY .= "Comment: ".nl2br($_POST["comment"])."<br>"; mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure. AGAIN."); ?> Your message was sent <?php } else { ?> <td width="468"><form action="contact_us_div.php" method="post"> <table width="400" border="0" cellspacing="2" cellpadding="0"> <tr> <td width="29%" class="bodytext">Customer First Name:</td> <td width="71%"><input name="name" type="text" id="name" size="32"></td> </tr> <tr> <td width="29%" class="bodytext">Customer Last Name:</td> <td width="71%"><input name="name" type="text" id="name" size="32"></td> </tr> <tr> <td width="29%" class="bodytext">Affiliation/Convention:</td> <td width="71%"><input name="name" type="text" id="name" size="32"></td> </tr> <tr> <td class="bodytext">Customer Home Number:</td> <td><input name="email" type="text" id="email" size="32"></td> </tr> <tr> <td width="29%" class="bodytext">Customer Cell Number:</td> <td width="71%"><input name="name" type="text" id="name" size="32"></td> </tr> <tr> <td width="29%" class="bodytext">Customer Work Number:</td> <td width="71%"><input name="name" type="text" id="name" size="32"></td> </tr> <tr> <td width="29%" class="bodytext">Dates for Rental:</td> <td width="71%"><input name="name" type="text" id="name" size="32"></td> </tr> <tr> <td nowrap="nowrap"><span class="style19"><font face="Verdana" color="#000000">Type of Equipment Needed</font></span></td> <td><select name="FieldData7"> <option value="Power Wheelchair">Power Wheelchair</option> <option value="Power Scooter">Power Scooter</option> <option value="Other">Other</option> </select> </td> </tr> <tr> <td class="bodytext">Addtional Comments:</td> <td><textarea name="comment" cols="45" rows="6" id="comment" class="bodytext"></textarea></td> </tr> <tr> <td class="bodytext"> </td> <td align="left" valign="top"><input type="submit" name="Submit" value="Send"></td> </tr> </table> </form> <?php }; ?> But it returns an error everytime I run it... I'm using Yahoo as a server, and I set up the PHP email to [email protected] as requested by Yahoo, but when I try to use the form, it returns an error... I'm a relative novice at PHP, and I'm curious as to what's wrong.... Can you troubleshoot the script for me, by chance?
×
×
  • 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.