473,978 Members | 30,246 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP Simple Mailer Help

3 New Member
Ok so I am mr.Knownothing when it comes to scripting...

I am trying to modify this script to omit fields that are not filled in. I have checkboxes and text fields.

Here is my current script:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3.  
  4.     $request_method = $_SERVER["REQUEST_METHOD"];
  5.     if($request_method == "GET"){
  6.       $query_vars = $_GET;
  7.     } elseif ($request_method == "POST"){
  8.       $query_vars = $_POST;
  9.     }
  10.     reset($query_vars);
  11.     $t = date("U");
  12.  
  13.     $file = $_SERVER['DOCUMENT_ROOT'] . "/../data/gdform_" . $t;
  14.     $fp = fopen($file,"w");
  15.     while (list ($key, $val) = each ($query_vars)) {
  16.      fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\n");
  17.      fputs($fp,"$val\n");
  18.      fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\n");
  19.      if ($key == "redirect") { $landing_page = $val;}
  20.     }
  21.     fclose($fp);
  22.     if ($landing_page != ""){
  23.     header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");
  24.     } else {
  25.     header("Location: http://".$_SERVER["HTTP_HOST"]."/");
  26.     }
  27.  
  28.  
  29.  
  30. ?>
  31.  
  32. Here is what I think I have to add to it:
  33.  
  34. if (is_array($val)) {
  35. for ($z=0;$z<count($val);$z++) {
  36.  
  37. if(strlen($val[$z])>0) // If the length of your value is greater than
  38. zero, then include it
  39. { $content .= "$key: $val[$z]\n"; }
  40.  
  41. }
  42. } else {
  43. $content .= "$key: $val\n";
  44. }
  45.  
I am not sure if that is correct or how to add it into the script. Sorry for such an ignorant question.

-Todd
Aug 7 '07 #1
2 1282
kovik
1,044 Recognized Expert Top Contributor
Maybe empty() would be of interest to you.
Aug 8 '07 #2
pbmods
5,821 Recognized Expert Expert
Heya, Todd. Welcome to TSDN!

Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.
Aug 8 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
7166
by: Raphael Gluck | last post by:
Hi all I am still finding my feet creating a website in ASP, and i'm trying to get to grips with users providing feeback to my site. my webhosts have the dundas mailer installed, and i am trying to get it to work for me. does it work in conjuction with regular html? can i add a <form> and text fields? and then will all that get sent with the page? I have a little script but i dont know how to modify it
2
5324
by: John Davis | last post by:
What is the **MOST** obvious reason why will this will fail (it's not syntax or anything specific to the object)? Function Mail(MailerProgram, Message, Subject, Format, FromEmail, ToEmail, ReplyTo, FromName, ToName, MailerPath, BCCEmail, Attachement) Set Mailer = Server.CreateObject("Persits.MailSender") if NOT isObject(Mailer) Then Mail = false Exit function
10
3184
by: Flopper | last post by:
Hey can anyone help me with a WORKING anonymous mailer php script. I've looked on the net but only find non working one's. Greetings Floppie
1
3276
by: Beyza | last post by:
Hi, I have a problem. One of my customer used to use php mailer in her web page. But when i changed something in the system (php packages) , it was broken. If she use php-mailer in her system, mails come base64 code. I did not understand why. Do you have any idea? I am pasting example mail header. : 55902; :25;Sat, 29 Jul 2006 05:51:26 -0500
4
6626
by: =?Utf-8?B?TWlrZSBI?= | last post by:
I'm using a block of ASP to allow a user to send a form via e-mail. However, someone keeps sending me spam through this form and they're using a bogus return address. I'm testing for a successful send, which should fail if the return address is not valid, but I'm still getting the junk. The block looks like this: Set Mailer = Server.CreateObject("SMTPsvg.Mailer") Mailer.RemoteHost = "smtp.xxx.com" Mailer.FromName =...
2
2029
by: kind1one | last post by:
I am green to PHP and trying to create outside PHP mailer for html form ,i found the script i need but I can't get it to upload more than one file ,since i do not know exactly where to place script request for file2-file10 as well as the exact line to place extension control and size limit ,SOS , any help would be aprishiated the mailer script: <?php if (strpos($_SERVER, $_SERVER)>7 || !strpos($_SERVER, $_SERVER)) ...
0
2727
by: askzda | last post by:
Hi, Can somebody pls help to solve above problem. I have used dundas mailer for my mailing part in my asp script, but the an error occured during sending the mail. Error that is prompted out just like below: Dundas.Mailer.1 error '80004005' The DATA command failed. I've checked all the recepients' email adresses and they all valid. SO, kindly help me to solve this kind error. I really appreciate ur help.
4
2380
by: patrickinminneapolis | last post by:
Hi guys, I'm trying to write an emailer, but I can't manage to construct the object properly. Here's what I've got: #!/usr/local/bin/perl -w use Net::SMTP; $smtp = Net::SMTP->new('mailhost'); print $smtp->domain,"\n"; $ perl mailer.txt Can't call method "domain" on an undefined value at mailer.txt line 6.
6
26424
by: Dave Kelly | last post by:
Sorry for the long post, it is easier to discard information than to have to wait for it to arrive. So here goes: This code worked perfectly when I was an Earthlink customer. Sprint decided not to pardner with Earthlink and create their own IP. Since then everything email has been broke. Sprint/Embarq is the only copper wire DSL provider where I live.
9
8291
by: neovantage | last post by:
hey geeks, I have a small mail script which will cause a PHP script to send a receipt upon clicking the submit button, by an HTML mail. This mail contains special characters, namely 'å', 'ä' and 'ö'. Whatever I try, I can't get these characters to display properly everywhere. In some email clients, these characters show up just fine, whereas in others they show up as question marks or kinda boxes. I've tried sending the mail as UTF-8, as...
0
11823
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11413
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11581
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7617
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6418
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
5160
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4732
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3764
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.