Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Emailing Form Data


I have a form that writes to an MySQL database just fine but would
like to email people to give them a heads up that an entry was made
under their name (1 of 6 names on writing to the database). This
server exists on an intranet and would have no 'web' function other
than using possibly the existing email server.

Is all that I need to do to make this happen, to change php.ini as
follows:

[mail function]
; For Win32 only.
SMTP = mail.servername.com
smtp_port = 25

; For Win32 only.
;sendmail_from = whoever@servername.com

My input form is as follows:
<form action="process2.php" method="post">
From: <input type="text" name="from" size="20" maxlength="20" /><br />
To: <input type="text" name="to" size="30" maxlength="30" /><br />
Subject: <input type="text" name="subject" size="30" maxlength="30"
/><br />
Message:<textarea name="text" name="message" cols="50"
rows="10"></textarea><br />
<input type="submit" name="submit" value="Send" />
</form>

and passes data to process2.php as shown in form 1:
<?php
@extract($_POST);
$from = stripslashes($from);
$to = stripslashes($to);
$subject = stripslashes($subject);
$message = stripslashes($message);
mail('$to',$from,$subject,$message);
header("location:process.php");
?>

This worked through my testbed on my SMTP 'once' and only sort of,
once so I might be missing something. :-)




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Processing Form Data And Emailing It In Html Format
I have a form that when submitted it just sends a regular email in plain text with all the information.  However I would like to be able to format the email so it is more organized with a table that contains the submitted information.  However all the tutorials I have gone over does not show how to pull information from the form fields and put them in the html message itself. 

They just show how to send an email in html format without any form data. My current code below is what I have been experimenting with and just sends plain text. Can anyone give me some assistance as to how to have the form data submit in html? Code:

Emailing Binary Data Question
I'm trying to create an 'email this picture' form using a php email class ("phpmailer"), & wish to embed the image in the body of the email, as opposed to attaching the image file.

The images are binary files referenced by fields in a mysql table, and are displayed using a function call that produces code without a .jpg extension - e.g. "<img src=img.php?f(3e7b67c7dd510)+w(45%)+h(45%)>" (I've used this script).

For the life of me I can't work out how to embed such an image into an email, & am thinking that maybe a workaround would be to rename the image with a simple .jpg title, save it to a temp directory, & delete after sending each email. What I'd like to know is:is this the best way to go forward?if so, how can it be done?

Emailing A Form
i have a form on my site that users will have to fill out and i need all the information emailed to me, can someone show me how to do that ?

Posting Form Data And Also Allow To Download Form Data
i have a client that whats to post form data to a database but he also wants users of the script to download it aswell how will i got about doing this i thought about it that i could make it save it into a txt file then echo the download link is there any ideas? because to post it to a txt file it would be posting 2 places is there a way to do this? Code:

Comparing Form Data To Mysql Data
Im interested in building a script that would take form data, a variable like an address, and compare it with a known address in a mysql table (called addresses), then if there is a match log the address information in a separate table called (addresslog), and return the visitor to a certain page. If there is no match between the address entered in the form and known addresses then the information is still logged into the addresslog database but the visitor will be sent to a different page.

I'm still new to this, and am working through the logic and the syntax, but I believe I'm close. It's still not working, I have all of the proper tables, maybe I'm way off with the coding so I thought I would seek out some expert advice. Here's the entire script with as much explanation as I could give. PHP Code:

Emailing
I use PHP and send emails like confirmations and notifications. But I found that most of our emails get sent directly into customer's bulk or spam folders. What can I do prevent emails from going in there?

A Question About Emailing
I am using mail() to send email, but when I test on my yahoo and
hotmail account, all emails are send to the yahoo&hotmail bulk folder.
Why? and how to avoid it?

Emailing From Webpage Issues
To All,
I am new to PHP and I come from ASP. Is there an easy way to allow users to email me from a webpage. I want to have a form that will include drop down, radio and check boxes and in ASP it's real easy to handle it, but I don't know where to start in PHP.

Emailing The Current Page
I now have a client who wants the facility for visitors to email a page
to friends. He doesn't want the link emailing, he wants the page
emailing "because people prefer that" - well, certainly not the people I
know, but he is paying... And I don't see the sense in this, because he
could end up sending code out that can't be interpreted by the mail
client.

As I don't use HTML email, can I ask - is there a way to get the page to
show automatically via a link, without the client clicking on it?

Mass Emailing Question
I am writing a mass mailing system for a company. They have arround 30,000 customer's and need to send email to each and everyone of them.

I have written mass mailing programs in the past (using php) and know that its best to:

1. Open one socket connection to sendmail
2. Use BCC as much as possible to lower the overheads
3. Send them in batches

The script I wrote in the past for my own website subscribers, however, seemed to die at around 3,000. so getting 30,000 might be a problem.

I was wondering if anyone had any experience of writing mass mailers of around 30,000 and if they could give me any advice regards ISP blacklisting and/or any tips on how to go about writing them (special methods etc.).

Emailing Product Details
i have kind of a shopping cart i can add products to the cart but i need to email this selected informtaion to an email address. PHP Code:

Bulk Emailing With SMTP
I'm researching ways of using PHP/mySQL to send a single HTML formatted email message with attachments to many, perhaps 1000 recipients.

From what I've read in this forum it seems a good idea to bulk mail by sending the mail message and recipient list to a SMTP server rather than repeatedly calling the mail() function. This avoids the situation where the server stops a php script from executing due to time out. What does SMTP support that makes it more effective for this sort of thing? also is the phpmailer class from Source Forge an effective php script for bulk mailing HTML formatted email to many users?

Printing Directly And Emailing
i have a registration web page....on the last page i give out all the information of the registration (student ID, course ID, Name etc etc...) now what i want to do is ....Email all that information to the email of the student (which he/she has provided earlier in the registration process) and also let them print out that information "with a printer friendly page".

Emailing Username And Password
I want to be able to look up a person username and password so that I can send there information to them by email. the code does get the email address and looks it up but the problem is getting the username and password to be retrived and to be displayed. The email is sent properly but for the username i get "Resource id #2" and password I get "Resource id #4" as output. The txtemail is sent by a form. PHP Code:

Uploading And Emailing Files
I'm trying to make a standard contact form that will be emailed to me upon submission. No problem.

The only thing is now I want to the users to attatch a: a picture, and b: a resume. Then, have those files and the contact info emailed to me.

I've found tutorials online that show how to allow users to upload files to a website, but how can I get that integrated with en ameil contact form so it's all just emailed to me and not just stored on the server somewhere?

Emailing Users When Signing Up
i got a members are set up and im haveing a problem wiht the fact that people are registering without proper emails e.e fake@notreal.com.... is there a way where for a user to sign up they have to have a random password sent to their email address... that way i can tell that their email is real or have them activate thair account via email ? Code:

Emailing Attachments Issue!
Ive got a problem with my site that I cant figure out... Im hoping someone on here knows what I should be looking at to find the problem here.

Summary: my site is a complex custom php/mysql scripts based site.
It has the facility to send uploaded word document to customers on request.

This used to work fine. But (and ive had this once before but fixed it without realising how!) ....since some recent seemingly unrelated development work, the emails are being sent to customers, but instead of being sent as an attachment the 'attached document' is actually being sent as part of the email.

So it is encoded into the emails body as opposed to attached seperately?!! 

Anyone have any ideas where to start looking! or what to do to locate the problem.

The server is mine (dedicated) and I have examined the mail logs and all is ok,the main email function works fine and sends normal emails no problem through other bits of the site. Code:

PHP Mass Emailing And Handling Bounces
I'm putting together a mass mailing application for sending out newsletters
from a site admin area (no spam).

I'm wondering how I can automate the removal of bounced addresses in this
application. The ideal situation would be that returning mail triggers a
script that removes the address of said message's recipient from the list.

I'm thinking about a script that checks the pop3 server of the reply-to
address and parses the inbox to look for returned mail and removes those
addresses from my database. This script could be run periodically as a cron
job or everytime before sending out the next mailing.

Emailing With An Attachment That Has Fetched From Db (longblob)
I am trying to send an email with an attachment.
The problem is the attachment is stored in db where I have created a
longblob field that contains the file so I have no idea how to specify
the file path when I want to send an email.
I have tried "" and "/" that didn't work.

My code is

------------------------------------------------------------------------

$fileatt = ""; // Path to the file
$fileatt_type = "text/html"; // File Type
$fileatt_name = "AttachFilename.txt"; // Filename that will be used
for the file as the attachment

$email_from = ""; // Who the email is from
$email_subject = "Testing"; // The Subject of the email
$email_txt = "how are you?"; // Message that the email has in it
$message_text = ""; // Message that the email has in it

$email_to = ""; // Who the email is too

$headers = "From: ".$email_from;

$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);

$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";

$headers .= "
MIME-Version: 1.0
" .
"Content-Type: multipart/mixed;
" .
" boundary="{$mime_boundary}"";

$email_message = "This is a multi-part message in MIME format.

" .
"--{$mime_boundary}
" .
"Content-Type:text/html; charset="iso-8859-1"
" .
"Content-Transfer-Encoding: 7bit

" .
$message_text . "

";

$data = chunk_split(base64_encode($data));

$email_message .= "--{$mime_boundary}
" .
"Content-Type: {$fileatt_type};
" .
" name="{$fileatt_name}"
" .
//"Content-Disposition: attachment;
" .
//" filename="{$fileatt_name}"
" .
"Content-Transfer-Encoding: base64

" .
$data . "

" .
"--{$mime_boundary}--
";

$ok = @mail($email_to, $email_subject, $email_message, $headers);

Emailing Sav Files, Wont Work?
Mailing sav files wont work but when I change the extension of the file to .txt it does work.

See Below Script:
//Attachment version of message
$extension=explode (".", file.sav); 
$countdot=count($extension)-1;
$extension=$extension[$countdot];
$headers .= "--{$boundary}
" .
"Content-Type: application/octet-stream
" .
"Content-Transfer-Encoding: base64
" .
"Content-Disposition: attachment; filename="file.sav"";
$headers .= chunk_split(base64_encode(file_get_contents('backup/file.sav)));
$headers .= "
 --{$boundary}--";}

if (!mail("geoff@googlemail.com", "Test", "", $headers)) { 
$erreur++; $erreurmsg.='There was a problem sending your email please try again.<br>'; 
}(As part of bigger script that deals with all the headers etc...)

The above script sends a email to the email address, I can pick it up. Gmail shows the clip logo (attachment), but when I view the actual email no attached files are shown. However if I change this line:

"Content-Disposition: attachment; filename="file.sav"
"; to this: "Content-Disposition: attachment; filename="file.txt"
"; the entire script works and I recieve the file but as a txt.

Does anyone have any idea how I can get sav files to be mailed. I have tried sending them using gmail (it works fine) and reading the mime but it is exactly the same as mine.

Emailing, 550 Not Local Host , Not A Gateway
Don't know if this is new news, old news or no news. Every time I tried to
email with my php/mysql combo I would receive a email back from the system
administrator with about 5 of the addresses listed with a message like this:

550 not local host <hostname>, not a gateway

Tried all the php fixes, ISP technical support, checked for port 25 blocking
and domain host support no dice. These were/are all good host names. Turned
out that in typing in and/or importing addresses some (Those being rejected)
were typed in capitol letters. As soon as they were converted to all
lowercase the problem went away. I posted this because you have saved my a**
so many times I can't count them. Why it worked I do not know but it worked.

News Posting Script With Emailing Ability
I am looking for a script that I can sit on an HTML server (Linux,
Apache, PHP/Perl/Python/Etc.) that will allow me to do the following things:

1) Post news articles that consists of (i) a title and (ii) a body.
2) Show the last X posts (or, better yet, just the last X titles) on a
home page.
3) Show all posts on a "news" page.
4) When a news article is posted, email the news article (with the title
being the email subject and the news body being the email body) to a
single address (which will be a Mailman email list address).
5) Preferably not require the use of a db server.
6) Preferably allow changing or deleting news posts if errors were made
in the wording or otherwise.
7) I do not need nor want the ability for users to "reply" to the news
articles.

Does anyone know of anything like this? If not, how about simple news
posting tools that I could remake to include the emailing functionality?

A tool similar to what I want is located at
http://newswriter2005.sourceforge.net/. This one, however, doesn't
allow email of news articles.

Also - what is the proper newsgroup for asking about server-side html
scripts? alt.html.server-side would be perfect, but it seems to be dead
(at least on the news server I use).

Getting Data To Form
How to create when enter staff no, it will automatically generate out the name in the same form ?

Getting Data From Mysql To Put Into Form
i am trying to set up a page that will allow the user to select a name from a list. The details of this name(ie, last name,address, job etc) are then taken from a database and put into a form. If any changes are needed the user makes them then presses a submit to update the database.

I can get the information out of the database and into the form fields but i have one small problem...

In the address field i can only get the first part of the address...
ie

if the address is 123 Sample Street

only 123 gets put into the form field.

How do i get the rest of the address to appear?

i am sure it is quite simple but cant quite put my finger on the answer!

my code is:

Address: <input type="Text" name="address" value =<?php echo $myrow["address"] ?>><br>

where $myrow is the array holding the results from my database query.

Any help would be appreciated!

Post Data W/out Form
I want to post variables to a php script, but I do not want to use a form to do this... is there some sort of header I can use to redirect and post values to another page?

Cookies and sessions are not an option, URL line ('get') variables can't hold large enough a string...

How To Use GnUPG With Form Data
I am looking to encrypt form data that is submitted over an SSL and send that via email to my client. I understand some of the basic encryption processes, but could someone help me understand :

1. How to encrypt the data with GnUPG before it is emailed.
2. What does my client need to be able to decrypt the data?
3. My web host currently offers GnUPG so I can generate the keys - what do I do next?

I have done some searching here already but I could use some getting started help.

Reload Form Data
I am developing a web site using php. I have a form for login in page1, which has two input box and a submit button. When I click the submit button in page1, it runs page2. When I click BACK button(now in page1), and FORWARD button (supposed to be in page2). Both IE and Netscape give me a message like the following (note: the browser cache is not turned off either by php header() or by browser setting):
*********************************************
This document resulted from a POST operation and has expired from the cache. If you wish you can repost the form data to recreate the document by pressing the
reload button.
*********************************************

When I press the RELOAD button, page2 is load correctly. Now, how can let the browser automatically do the reload without showing me the above message?

Inserting Data Using A Form
I created a script to allow the user to select the number of images to enter. After that the script generates the entry fields dynamically. The final step is entering all images into one column in the db called images.
The problem is i got it to work using an advice from someone at devshed forums to use some additonal script. Please see below.

1) HTML File that allows you to enter the number of text boxes to create for each image you want.


<FORM METHOD="POST" ACTION="do_show.php">
<P><strong>Number of images:</strong><br>
<INPUT TYPE="text" NAME="num_imgs" SIZE=5></p>
<P><INPUT TYPE="submit" NAME="submit" VALUE="Go to Step 2"></p>
</FORM>

2) PHP file that shows the created text boxes for you to enter the names of these images:

Problem With Form Data.
I have a form that I need to be able to input html, such as < a href="blah">blah</ a> and store it in a database, but php automatically puts 's in front of quotations and apostrophys, is there anyway to prevent this from happening so when it is stored in the database it will be just as they typed it in the text field and not insert back slashes?


How To Save Form Data?
There is a button on one of my www pages which changes page content. It
adds some fields to the form, which is created by php script. After
changing the page is displayed once again. What I want to do is to save
form data so after changing and reloading the page field are filled.
That button is not Submit button. Can I do such thing?

Parsing Form Data
Im using Reichard Heyes Form Processor with php3 for customers to attach multiple image files to email to me. This form uses a template to print the emailbut I cant get the email to print the original file name for example:

file1.......johns image.jpg
File2.....Marys image.jpg

Sounds easy and most likely is but Im stuffed if I can get it to print So far all I can get is the Temp file name.

Form Data Not Posting
I was reading the forums and have not found the answer and could use some help. I am a novice and am learning how to do this out of neccesity for my non-profit org. I have a database with incidents that we react to during emergencies. I want to be able to have the users call up the record via ID (that works), change the status and/or details and save update mysql. It is just not saving the data. PHP Code:

Processing Form Data
I've just built a form that enables users to pick a city from a pull down menu. On the processing page i want to assign the city picked to a variable. So lets say the name of the form is "city" and i want to assign the city picked to a variable.

$citychosen = ********

What do i use to get the chosen city there. I want to use the variable in the next part of the page which uses an SQL query to show info about the city chosen. So the SQL query would look like this Select * from table1 Where city=$citychosen .

Retrieving Form Data.
I have two scripts - common.php and edit.php. The working is that common.php contains a form that is used initially for registration and later used again so that registered users can edit their information. edit.php contains the connection to the db to update the form with the current users information. PHP Code:

Web Form Data To MySQL DB
I pulled this script off of an MySQL article from the MySQL website itself. I adjusted it to my needs and I could connect to the DB, it could find the proper table, but it doesn't enter the data into the database table. So I pulled the original script off in hand, created the DB and table it had listed and still the same problem... it can't connect. Here's the script: Code:

Redirect Form Data
I've had help creating a redirect script, and that has worked successfully for inserting information into MySQL and the redirecting the user to the desired page when they clicked on a common link. A problem that I encountered is my script does not pass variables from a form, and I'd like to find a way to include those variables and redirect with the POSTed variables. PHP Code:

Form Data Will Not Post
can anyone be so kind as to look at

http://www.mysolution.ws/HYPOCRITE.php

and let me know why it isn't passing the form data to

http://www.mysolution.ws/insertHYPOCRITES.php

for the most part, the scripts were created with
http://phpcodegenie.sourceforge.net/

How Do You Add Data To A Database Via A Form?
I have a mysql database and I'm using PHP to access it. Has anyone got a piece of code that will allow me to use an HTML form to add data to the database?

Retaining Form Data
I want users to be able to go back to an assessment form after viewing the results. Here is a bit of the code I am trying. When I go "Back" the radio button is always selected in the last field. What am I doing wrong? Code:

Form Data Validator
Can any one recommend a class for form data validation?
Seems something all of us need to do.

I am constructing a large on line app and my validation needs are going
to be quite wide in range.

Array Of Form Data
After submitting form data to a page called procform.php, I want to be
able to see a list or array of all the inputs that were submitted from
the form. I scoured the PHP books I own and did some google searches,
but found nothing in this regard. I know I can use $myformvar in
procform.php if I know the form had an input like this: <input
type=hidden name=myformvar value=190> But, surely, there must be a way
to get a list of all the variables assigned from the form in PHP, right?

Form Data Loss
I have recently started experiencing form data loss. Here is an
example:

====test_form1.php====

<form method="POST" action="test_form2.php">
<input name="textboxvalue" type="text" size="20">
<br>
<input type="submit" value="Submit">
</form>

======================

====test_form2.php====
<?
echo "textboxvalue: ".$textboxvalue;
?>
======================

(note: these are incomplete examples, I have left out the <html> tags
for example)

After putting in data into the textboxvalue textbox and pressing the
submit button, on the second page only "textboxvalue: " is displayed.
The weird thing is that when I restart my computer, this works fine,
but then stops working again. These pages are encrypted with 128 SSL
encryption (mod_SSL 2.8.15).

This problem has plagued an online app that I am developing and is a
company-wide problem that happens on computers in other offices too.

Here's my info:

SERVER
Apache 1.3.28
PHP 4.3.6
MySQL 3.23.39
mod_SSL 2.8.15
phpMyAdmin 2.50

CLIENT
Windows XP Pro
Internet Explorer 6.0.28

Formatting Form Data
I have a problem understanding how I can submit form data to a mysql database and preserve the formatting that the user wants. Essentially the problem is line breaks. When a user inserts data into a text area the text automatically jumps to the next line when the one line fills up with text.

Yet when the data is submitted to mysql it doesn't preserve the breaks. I've tried several solutions like the <pre> tag. Basically I want the break that the html textarea creates automatically when it reaches the end of the text area to generate a <br /> tag in my data submission.

Prefilling A Form With PHP Data
I'm trying to fill out a form with data pulled from a database. Look at the first entry for my form, the First Name. I have a PHP in the value section but it is not pulling down the data and inserting it. Not sure why. Code:

Data From A Form To A Template
I have a PHP script that gets data from a form and sends it to an email address. Got that working no problem. now I would like to take the data form the form and instead of just emailing it I need to put it into a template that I have created using html and tables and then emails this template to a specific email address.

Passing Form Data
I have a project that consists of a large quiz that displays multiple questions per page from a database and then saves those answers to another database table. The issue I'm having is with a form that consists of radio buttons and check boxes. The form is only submitting the last checked value for the check boxes rather than all checked values. I'm sure this is an easy fix but my mind is about to explode from a full day's work and a lot of time trying to figure this out, so I was wondering if someone could give me a hand. Code:

Persistent Form Data?
I've set up a form with captcha and if someone enters the wrong captcha info and returns to the form to fix it, the previously filled in data is wiped out. What do I need to add so that the information persists? Would it be a session or cookie or ?

Form Data Pass Through
I have a site that uses pay pal subscriptions. The only problem with their service is that it only allows me to pass two user inputted variables from that form to the paypal site. I'd like to pass a number of other variables describing the user and their subscription preferences.

The best way i can think of doing this would be to first run a php mailer to email me the additional data along with the user's identity, and then have that php mailer submit the info to the paypal cgi script.

Is this possible? i'm a complete php newbie, but i'm willing to earn. Hopefully someone can point me in the correct direction so that i can figure out how to modify my current php mailer to accomplish this.

PHP To Create PDF With Form Data?
Is it at all possible to create a PDF file using input that is entered from a form?  What I'm interested in doing is creating a detailed online application that the applicant fills out, then once submitted, a PDF is created of the application, where it is then sent to the hiring coordinator and the applicant has an opportunity to view/print their application via the same PDF. 

I know it sounds like a lot, but it's just a thought. Is this remotely workable? If so, where do I start? I'm creating such a form now, but i'm not sure the steps to take after this..


Copyright © 2005-08 www.BigResource.com, All rights reserved