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




Form Variables Not Printing In E-mail


This is my first attempt at a php-based form at work in order to personalize the form response with the submitter's name. When I submit the form, all that's returned to me via e-mail is the header information. I've been searching google but can't figure out what I've done wrong. The php to process the form is this:




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Printing All Stored Session Variables
In my first page I passed variables to my second page and I stored them as session variables of the same name in my 2nd page. However in my 3rd page I want to echo all the session variables I stored in the 2nd page. Any idea on how to do this? Here is my code in the 2nd page for storing the session variables. Code:

Parse Area - Printing Variables In Single Quotes?
I get the parse error: unexpected T_VARIABLE, expecting ',' or '' when I try to run this code. PHP Code:

Printing Out Info From A Form
I have this php function that reads a text file for input to create a form. I am trying to get the form to print out the data on a separate page, but all I get is a blank page. Am I calling the page correctly, or is this even possible to do? Code:

Printing Mysql Auto-increment Key Value On A Form
i need to print off the auto increment key value on a form. How does the syntax go to accompish this. Field name is rrn. Output only.

Printing Form My Host To A Remote Location
Just wondering if anyone knows if it is possible to print direct from a php script on my host to a remote location ie at my house. Also if this is possible is it possible to hold a que until my computer is on.

Mail Form Not Sending Mail - Server2003
I am trying to test a simple feedback form. I have php 5.0.3.3 on my dev
Windows server 2003. SMTP is working fine, as we all use it to send mail
from. PHP works fine as well, but I just cant get mail sent by php, although
no errors are reported.

Do I understand it correctly that this simple script should send me a mail?
This is just to test that it works.

<?php
mail('me@whatever.com', 'My Subject', 'message');
header( "Location: http://webserver/message_sent.htm" );
?>

Okay, the " Location: http://webserver/message_sent.htm" comes up fine, and
"<?php phpinfo() ?>" also works fine. SMTP allows relay from my subnet and
does not need authentication.

Form Variables To Session Variables
I am writing a small script that consists of two pages:  page one displays a bunch of values from a DB (ie. First Name, Last Name, Phone Number).  On this page you will find a form that follows this format:

<input type="text" name="edit_firstname" size="20" maxlength="35" value='Bob'>
<input type="text" name="edit_lastname" size="20" maxlength="35" value='Smith'>
<input type="text" name="edit_phone" size="20" maxlength="35" value='5552222'>

So when you see the page there will already be a 'default' value in each line (which is information extracted from a DB).  This works perfectly and has been tested thoroughly.

On the second page I have the following code:

$editfirstname = $_POST['edit_firstname'];
$editlastname = $_POST['edit_lastname'];
$editphone = $_POST['edit_phone'];

What I am trying to do is this:  the default value for edit_firstname from the form is 'Bob' by default, but the user can change this in the input field on the first page.  This value, whether changed or unchanged, should then be stored as edit_firstname and by calling up the function $_POST[''] on the second page I want to transfer the value to the variable $editfirstname. 

However, it seems that $_POST['edit_firstname'] and the other fields do not return a value at all, hence $editfirstname = '' or $editfirstname = 'NULL'.  I have never tried to do things this way before. 

How To Use Variables In A Mail?
I need to show the values of a few variables in a mail genereted by a PHP script. Here is the mail: PHP Code:

Displaying Variables In PHP Mail
I send the mail by using:

Assigning Variables To A Variable / Mail()
What I want to do is send a list of variables through email. I have the mail() working. My problem is assigning the varibles.

$what2mail = $ price1 $price2 $subtotal ;
$to = $email;
mail($to, "Order", $what2mail,"From:me@mycompany.com");

Obviously the $what2mail line is not correct. This will also include some text, i.e. Your order has been received.

Sending Mail With Variables In, Maybe Due To Slashes?
I'm using two pages, one with a form and the $email_content variable which (in the full version) can be edited by the site visitor, the other page to send an html email containing the $email_contact variable. Can anyone see the best way to do this in terms of using the appropriate functions?

I'm using htmlentities on the first page and stripslashes but it's not working properly, I may be on the wrong track? I've experimented but either the email doesn't sent, or it excludes the variable, or it has slashes in the email which affect it visually. Code:

Putting Variables Into The $body Variable In Mail()
I'm working on an email form. It works until I add a variable to the $body variable contents. Can anyone see what I'm doing wrong? Here is a simplified version of what I'm doing:

<?php
$message = (isset($_POST['message'])? $_POST['message'] : '');
$email = "breeders@example.com";
$headers = 'MIME-Version: 1.0' . "";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "";
$headers .= "From:breeder@example.com";
$headers .= "Reply-To:" . $email . "";
$body = "
<html>
<head>
</head>
<body>
<p>Part of the body</p>
<p>" . $message . "</p>
</body>
</html>
";
if (isset($_POST['submit']))
{
mail('info@example.com', 'This Subject', $body, $headers);
}
?>
<form>
<input type='text' name='message' size=&#3920;' value='' />
<input type='submit' value='test' />
</form>

Following Up Form Variables
i've coded a website to take information from a user, and then output it to a printable page to send in. The site is actually for a non-profit org, and this is for a contribution form.

I have a checkbox place to put into a variable called $bird[]. $bird[] prints out fine on the page directly after, but how do I keep the value of it and send that variable on to the next page? So on the next page I can also print out the value of $bird[]. On the second page, I used: PHP Code:

Form Variables
Wonder if there is any way to check all variables through a loop when a form is submitted.
I have few checkboxes (chk1,chk2,chk3...) in a form and in a php file I wanted to go through a loop to check which checkbox is 'on' and then so something with that variable.

Using Variables From Form
I've just started learning php and I hope you guys could help me with
this problem. I've found a useful pice of code from a book to make a form
and I would like to use it. I would like to print the variables (input)
on the screen , but I can't make it work. I think I have to do something
with an array, but don't know what. I've tried

$field = $_POST['field'];
echo $field;

and also

$arr = $_POST['array'];
print_r($arr);

but it doesn't work.

Could some one show me what I'm missing?

########################### code ###################################

<?php

// new function
echo "<br><br><h4>second function</h4>
";

function print_form($action="", $method="post")
{
if (empty($action)){return FALSE;}
echo "<form action=$action method=$method>
";
$numargs = func_num_args();
for($i = 2; $i < $numargs; $i++)
{
echo "$i <input type = text name =". func_get_args($i) . ">
<br>
";
}
echo "<input type=submit>";

echo "</form>";
}
print_form("autoform2.php", "", "field", "field2", "field3", "field4");

// testing if the variable exist...and it doesn't...
if(isset($_POST['field'])){
echo "exist";
}
else {
echo "does not exist!";
}

?>

########################### end code ##################################

Mail-form Php
I have a problem with php. I guess I am tired because I sure this is
simple, but I just can't make a simple mailscript work. I have to pages.
One htm and one php. Here's the code:

contact.html
<html>
<head>
<title>Kontakt</title>
<link rel="stylesheet" href="../css/style.css">

</head>
<body>
<h1>Kontakt</h1>
<h2>Kontakt</h2>
<form method="post" action="send.php">
Namn:<br><input name="name" type="text" size="30"><br><br>
Email:<br><input name="email" type="text" size="30"><br><br>
&Auml;rende:<br><input name="subject" type="text" size="30"><br><br>
Meddelande:<br><textarea name="msg" cols="25"
rows="6"></textarea><br><br>
<input type="reset" value="Reset">&nbsp;<input type="submit"
value="Send">
</form>
</body>
</html>

send.php
<html>
<head>
<title>Kontakta oss</title>
<link rel="stylesheet" href="../css/style.css">

</head>
<body>

<?php
$to = "clownen2005@telia.com"; //
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$msg = $_POST['msg'];
$sub = "form to mail";
$messub = "Subject: ".$subject."
";
$mesmsg .= "Message: ".$msg."
";
$mesname .= "Name: ".$name."
";
$mesemail .= "Email: ".$email."
";
if(empty($name) || empty($email) || empty($subject) || empty($msg)) {
echo " <h3>Du m&aring;ste fylla i alla f&auml;lt.</h3>";
}
elseif(!ereg("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$",
$email)) {
print " <h3>Din email är felaktig.</h3>";
} else {
mail('$to', $sub, $messub, $mesmsg, $mesname, $mesemail);
print " <h3><center>Tack ".$name." f&ouml;r att du kontaktar
oss.</center></h3>";
}
?>
</body>
</html>

Can anyone tell me what I am doing wrong?

Mail Form
I am trying to make a form with PHP so users can submit a problem that they are having with our services, but I don't know what to do. I'm trying to make it so when they hit the "submit" button it e-mails it to me. Also, I would like for the entries "Subject" to be filled out on the form and the body message of the e-mail to be filled out on the form.

Mail-form
to make a mail-form with PHP. But the point is I want a function
so the user can choose the receiver (adress) with a drop-down menu box.

example: http://www.battaniye.net/?git=5

How can I program this in PHP ?

Php Mail Form
I've been delving into php for the past two months, and gotten pretty
good at writing variables and such noonsense.

I was looking to make a mailing form for my website, instead of using
the crappy mailto:isuck@ophp.com stuff.

Anyone have any ideas as to where I might find this?

I'm looking more for something that is as beginner as possible, so that
I may customize it as I become more accustomed to the language.

Form-to-PGP Mail
I have a form on my website that lets users email me details. I want to upgrade this so that they can send me their credit card details too.

I have a dedicated server. If I buy a SSL certificate, then I have a secure connection from the user's computer to the web server. But to get a secure connection from the web server to my computer I need to use PGP. I have not used this before. Is it possible to use PGP from a web form to email credit card details to a computer?

Mail Form
I have have several websites that use a simple mail form to send email to site admin.  I noticed on of them is getting hit by a "bot" and spamming viagra ads to the site admin.

How can I prevent this?  Do I do one of those pictures with letters, which seems annoying to the visitor or is there a way in the code? Code:

Form Variables Without Submit
Is there a way to pass variables from a form to PHP without submitting the form? ie. retrieving a user's selection from a picklist or checkbox.

Can You _POST Variables In Php Without Using A <FORM>
The question I have, is it possible for a php script which is used to
validate values submitted in a form, to then post these values onto
another script/page or even back to the calling form?

i.e. the application I have in question is a login.htm page with a
verify.php script The login.htm has a Form which captures login_id and password which are posted to verify.php

verify.php checks the id and password against the database.
if the check succeeds I use $_SESSION to track the logged in user into
the page. if the check fails, I use $_SESSION["error"] to set an error message
and then jump to login.htm, but I've lost the userid.

The only way I can see of transferring the userid (and some other data)
is by calling header ("Location: login.htm?id=$uid");
and then have some php code in login.htm to $GET['uid'] and pop that
into the user field on the form.

Is there any easy way I can post this data back without using a <FORM>
or at least a form that can be auto-submitted?

Find Form Variables
Is there a way to read the variable names passed by a form if you dont know their names.
I have a site where the users can edit a form but I need to then process it.

Passing Variables From A Form
Well I am having some strange problems with a web-based form that is used for users to submit data. I have moved the form and accompanying PHP files across from a Redhat 7.3 install to a new Redhat 9 server running Apache 2.0.40-21, with php-4.2.2-17. So, it is stock standard. Everything was working ok on the Redhat 7.3 install. The troubles I have run into is when I try and pass a variable from a form such as below: Code:

Passing Form Variables To A Pop-up
I've searched the forums for this, but haven't seen any posts or solutions about this particular problem...I have a form in a php script that submits like this: Code:

Form Variables Gone Missing
hope I'm on-topic here - couldn't find any leads with a search so
maybe someone has an idea.

I've got a PHP form that is supposed to set some variables from
its fields and then call itself by the POST method.

Here is e.g. a minimal test version called "top.php":-

#!/usr/bin/php
Content-type: text/html

<HTML>

Welcome <?php echo $_POST["name"]; ?>.<br />
You are <?php echo $_POST["age"]; ?> years old! <br>
Welcome <?php echo $name; ?>.<br />
You are <?php echo $age; ?> years old! <br>

<form action="top.php" method="POST">
Enter your name: <input type="text" name="name" />
Enter your age: <input type="text" name="age" />
<input type="submit" />
</form>

<? phpinfo(); ?>

</HTML>

When I enter data in the fields name or age, it just gets ignored,
goes missing, thrown away by PHP. The first 4 lines that should
output this info show that the variables are all blank.

The phpinfo() call at the end shows me clearly that register_globals
is on.

The only way I've found so far is with the GET method - there the
expected arrays and variables are also broken,
but $_SERVER["REQUEST_URI"] is correctly set (yipee!) and so
I can parse that myself - sort of defeats the point of PHP though.

What could be the problem here?
Is there some other setting I'm missing?
This stuff all worked without a hitch in PHP3 - has something
else been broken in the name of security?

Passing Variables Through A Form
I have a setup where I am displaying lots of information, all of it comes from contact forms and is stored in a database. Then can be viewed on one page, through the scripts. One feature is that you can click on an email address to send an email to that specific user. When you click their email, the form comes up fine, and I have been playing with this for awhile.. I am having trouble getting the variables passed through so that I can send the email and update the database. Code:

Passing Form Variables
I'm trying to make a page that will let you change the order in which some items are displayed. The problem I'm having is passing back the id value of the item that you want to move up or down in the display order. Here is the code:

Passing Form Variables
Is there a way to read the variable names passed by a form if you dont know their names. I have a site where the users can edit a form but I need to then process it.

Session Variables In A Form
i want to create a form that updates a users account details...is there a way that i can get the form to show the users current details in each text box? then the user clicks on that box to edit the deails?

also how would i structure a query so that it only updates the edited fields? and keeps the rest the same? Code:

Mail Form From Flash
I am trying to pass variables from my flash input text fields to a php script and mail them. Simple enough but programming is not my expertise, and I can't get the mail to send. I know it is accessing the script because it returns the "thanks, your mail has been sent" variable back to my flash movie, but I receive no email.

<?
$ToEmail = "arunesuv@aol.com";
##$ToName = "Arune";
$ToSubject = "web site email";
$EmailBody = "Sent By: $name
Senders Email: $email
Senders Company: $company
Message Sent: $message
position: $position";
mail($ToName." <".$ToEmail.">",$ToSubject, $EmailBody, "From: ".$name." <".$email.">");
Print "_root.contact_mc.mail.EmailStatus=Thanks, your mail has been sent";
?>

Slow Mail() From Form
I have a simple form where I am sending the form results back to the submiter and form some reason the script will take up to a minute to complete it's submission. Here's the code I'm using: Code:

Php Mail Form And Spam
I have a feedback form on my site. People can fill the fields and
message is sent to me using 'mail' function, after the form gets
submitted (POST).

The fields are subject, from and text. 'subject' is optional, others
are mandatory. PHP script that handles the form input takes in account
predefined field names only.

The problem is that someone is sending me spam using that form. I
don't believe that they target me specificaly. It is more likely that
some automated robot is doing that. I tried to change field names, but
still getting the messages. I checked the message source, and they are
comming from the form.

My question is how they can guess the field names and determine which
mean what by automated process ? I guess they can parse html form to
get names, but how they can put values in proper fields ? Are they
using trial and error ? I should get messages with text in subject
field, too, then, but I don't.

Mail Form With Attachment
I am using a form in which allows a user to attach a file to the mail. PHP Code:

Mail Form Problem
I'm trying to send information from a contact page to my own email
adress. I have tried several php scripts but none of them seem to work
on the servers from Directnick. I contacted them and they came up with
the following:

(quote)
For the mail function to work, you must send the mail as if it were
from A VALID Premium Hosting POP3 account. You do this by including the
name of the account in the mail headers, such as...

mail('nobody@example.com', 'the subject', 'the message', null, '-f{put
your pop3 email address here}');

OR

$to = 'nobody@example.com'
$subject = 'the subject'
$message = 'hello'
$headers = 'From: {put your pop3 email address here}' . "/r/n";
mail($to, $subject, $message, $headers);
(unquote)



Mail Form With Attachment
im a beginner and need to modify a script, instead of the attachment being sent to the admin email i need it to be delivered back to the sender, Code:

Pop Up Window From A Php Mail Form
I have a php mail form that loads a "thank you" page when its submitted correctly... I want that "thank you" page to be a pop up window...

// Result options
$header[0]="";
$footer[0]="";
$error_page[0]="";
$thanks_page[0]="thank_you_mailing.html";

not sure how to add to that last line to make a pop up happen..

PHP And Flash Mail Form....
I have an email form built in flash 2004 and using this action script, along with some PHP that i will paste in at the bottom, should send emails to me but it doesnt. Any ideas whats going wrong?? Code:

Form Variables And Text Characters
Well I´m having trouble with text formatting I think.
You see I have a flash form, which sends variables
via POST to a php file that looks like this:

Passing Variables Through FORM -> IMAGES
I have to say this is bugging me, I'm trying to pass a variable through a form, but instead of "select" then "submit" type of form, I am trying to use IMAGES instead...

I am trying to pass the variable ($lang) , depending on the value of this variable, the page will look different (English or French )

I guess I am doing this the wrong way, I thought by giving both images the same name, but different values, it would work.... but it is not working.

here is the HTML code of the form itself :

Code:
<!--LANGUAGE SELECTION -->
<FORM NAME="pick_lang" METHOD="post" ACTION="<? echo "$PHP_SELF"; ?>">
<table border="0" cellpadding="0" cellspacing="0" width="165">
<tr>
<td rowspan="2"><img name="shadow_drapeau_r1_c1" src="tble_img/shadow_drapeau_r1_c1.gif" width="102" height="21" border="0"></td>
<td>
<INPUT TYPE="image" BORDER="0" NAME="lang" value="en" SRC="tble_img/shadow_drapeau_r1_c2.gif" WIDTH="21" HEIGHT="14">
</td>
<td rowspan="2"><img name="shadow_drapeau_r1_c3" src="tble_img/shadow_drapeau_r1_c3.gif" width="8" height="21" border="0"></td>
<td>
<INPUT TYPE="image" BORDER="0" NAME="lang" value="fr" SRC="tble_img/shadow_drapeau_r1_c4.gif" WIDTH="21" HEIGHT="14">
</td>
<td rowspan="2"><img name="shadow_drapeau_r1_c5" src="tble_img/shadow_drapeau_r1_c5.gif" width="13" height="21" border="0"></td>
</tr>
<tr>
<td><img name="shadow_drapeau_r2_c2" src="tble_img/shadow_drapeau_r2_c2.gif" width="21" height="7" border="0"></td>
<td><img name="shadow_drapeau_r2_c4" src="tble_img/shadow_drapeau_r2_c4.gif" width="21" height="7" border="0"></td>
</tr>
</table>
</FORM>
<!--END LANGUAGE SELECTION -->

I don't want to set images with links (<A HREF="$PHP_SELF?lang=$lang"> works, but I want the URL to remain clear of data)

How To Make PHP 'grab' Variables From A WML Form
I really can't get forms to pass data to my scripts. Now someone mentioned something about grabbing it and posted some code, but for the life of me I cannot find the email/post/whatever the hell it was, so can someone please tell me how a PHP script can be made to 'grab' a variable from a form.

Pass The Variables In The Form Of Sessions
If I have something like this how can i pass the variables
in the form of sessions to another page, where i Can calculate based on the products selected, very much like a shopping cart! PHP Code:

Editing Submitted Form Using Variables
I'm working an e-mail form for my web page. I want people to be able to fill out information and when the click submit, get a page that basically says, "Here is the information, is it correct?"
Then they can click either, "Yes" (and it sumbits), or "No", and it goes to another page set up like the form filled out the first time, and grabs the variables and places them in the "values". This is the code I have so far: Code:

Variables Not Passed From Url Or Form To Page
I use a Mac at home running OSX 10.2, and use the Apache PHP MySQL trio for developing and testing sites. I've had very good experiences with this setup and have had no major problems till now.

I noticed recently that variables added to the end of the url (the get method, ...url/page.php?var=value) are not passed to the script within the page. Forms using either the get or post method have the same problem. For example, a page named "foobar.php" containing this: Code:

Getting $_POST Variables From Form In A Function
I've loaded various thoughts I've collected into mysql. I want to write an
app, all in one file, that has the following features:

1. On initial entry, selects and displays the thoughts ( might add
pagination later - there aren't alot of records, for now.)
2. This main page includes separate forms near the top with submit buttons
to search, add a thought, view all thoughts, etc. The action for each form
is to call this same page. The submit buttons and thoughts are printed from
a function.
3. In the main logic, I am trying to do a $_POST and if isset() on each
submit button name and then call a corresponding function, do whatever it
has to do, unset the form variable and continue back to the main display.

The problem is that it's not calling any functions. The error log says that
the name of each submit button in my $_POST[] statements in the main logic
is an undefined index. I presume that they are undefined in the main logic
because the forms were defined in a function.

Is there anyway to access, in the same page, form variables that were
declared in a function on that page?

Form Variables In The Address Line.
I have created a form with hidden variables and submit button which
initiate downloading of a new page. After submit-button is pressed and
new page is downloaded I can see values of all hidden variables in the
address line of the browser. It is strange that another form does not
produce this effect (variables in address line). I cannot find out
which difference in forms originates different behavior. May be you
have some ideas?

Form Variables Not Being Read By Php Script
I've got an HTML form that submits to a php script. Now, this was done on one server, and worked perfectly fine. I upload to another server, and the variables are not being read by the script at all! If I set method=get, the variables are in the url, but the php code doesn't seem to be getting them at all. any suggestions?

Form Button Names As Variables
perhaps I am just a little tired, but I am having trouble with my form
buttons.

Firstly I name them like this
name="round".$counter."heats"
which results in variables
$round1heats
$round2heats
$round3heats
etc...
now, when I select button named ... "round1heats" ... I want to use the
variable $round1heats to remove the button "round1heats", and display heats
set for the round. To do that I assumed that I would have to:-
IF(isset($round1heats)){
show other stuff instead etc
}else{
generate and print html for button "round1heats"
}

My problem is, since all this is dynamic, since the number of heats is
variable, and is dependant on DB entries, how do I generate the $round1heats
used in the isset() so that it is recognised as a variable by the isset().
I have tried, to concat the bits as I have done in the naming of the button,
but, unsurprisingly, it spits out errors ;)
[note, $counter is still available, and is limited to the number of rounds
registered in DB.]
OR, have I been barking up the wrong tree altogether?


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