Democratic Underground Latest Greatest Lobby Journals Search Options Help Login
Google

*EMERGENCY* PHP Gurus! I need your help!!

Printer-friendly format Printer-friendly format
Printer-friendly format Email this thread to a friend
Printer-friendly format Bookmark this thread
This topic is archived.
Home » Discuss » The DU Lounge Donate to DU
 
Hawkeye-X Donating Member (1000+ posts) Send PM | Profile | Ignore Wed Oct-06-04 05:46 PM
Original message
*EMERGENCY* PHP Gurus! I need your help!!
Hey, I have here a formmail.php that was helped written by
sirjwtheblack

THe problem? It comes out like this (ESPECIALLY when I filled
out the form at http://www.navoting.com/registeration.html)

Date:   	6 Oct 2004 22:30:06 -0000
From:  	admin@unixplesk1.nexpoint.net
To:  	registration@navoting.com
Subject:  	Mail from Native American Project Registration


Name:  

Tribal Affiliation:

Title:

Address:

City:

State:

Zip Code:

Phone:

Mobile:

Fax:

email: 

Formmail.php looks like this

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<title>Form Submitted</title>


<style type="text/css">
<!--
.style1 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 36px;
}
-->
</style></head>

<body>
<?php 
$TextVariable = '&results='; 
$response = 'Data Sent. Thank You.'; 
echo $TextVariable; 
echo $response; 
/* recipients */ 
$recipient .= "registration@navoting.com" ; 
/* subject */ 
$subject = "Mail from Native American Project
Registration"; 
/* message */ 
$message .= "Name: $name 

Tribal Affiliation: $tribe

Title: $title

Address: $address

City: $city

State: $state

Zip Code: $zip

Phone: $phone

Mobile: $mobile

Fax: $fax

email: $email\n"; 
/* add as many lines here as you have on your form. 
$headers .= "From: $name <$email>\n"; 


/* and now mail it */ 
mail($recipient, $subject, $message, $headers); 
?>

<p>&nbsp;</p>
<p align="center"><span
class="style1">Registration Submitted
</span></p>
<p align="center"><span
class="style1">Successfully!
</span></p>
<p align="center">&nbsp;</p>
<p align="center">You will now be redirected
back to <a
href="http://www.navoting.com/registration.html">http://www.navoting.com/registration.html</a></p>
<p align="center">&nbsp;</p>
</body>
</html>
Printer Friendly | Permalink |  | Top
apnu Donating Member (1000+ posts) Send PM | Profile | Ignore Wed Oct-06-04 05:51 PM
Response to Original message
1. sounds like your variables aren't being processed?
you might have to call them down from the POST_VARS in memory after the submit button has been hit. Something like this:

<? $tribe= $_POST<"tribe">;
$address= $_POST<"address">;
$city= $_POST<"city">;
$state= $_POST<"state">;
?>

At least that's what I had to do on newer builds of Apache and PHP. They turned off the always accessable form variables, but this way you can get them down with out messing around with the the server config or the php.ini file.
Printer Friendly | Permalink |  | Top
 
Hawkeye-X Donating Member (1000+ posts) Send PM | Profile | Ignore Wed Oct-06-04 05:58 PM
Response to Reply #1
2. This is what Nexpoint said
hello,

We spoke on the phone today regarding your PHP script. 

The latest version of PHP no longer generates a variable for
each element of the form. All form elements are store in the
$_POST array. To access an element of this array corresponding
to your form you would enter:

$_POST["name"]
$_POST["tribe"]
$_POST["title"]
$_POST["address"]

You can no longer use the predefined variables since later
versions of PHP took this out as a security measure. You can
find out more information about reserved and predefined
variables at the following web page:

http://us2.php.net/manual/en/reserved.variables.php

[font size="3"][red]So translate that for me!
Printer Friendly | Permalink |  | Top
 
TlalocW Donating Member (1000+ posts) Send PM | Profile | Ignore Wed Oct-06-04 06:01 PM
Response to Reply #2
4. So instead of putting...
fax: $fax

You need to put

fax: $_POST<"fax">

from the sounds of it.

TlalocW
Printer Friendly | Permalink |  | Top
 
apnu Donating Member (1000+ posts) Send PM | Profile | Ignore Wed Oct-06-04 06:08 PM
Response to Reply #2
7. well what my code does is...
takes the var out of the _POST and puts it into a variable for your form.

so $tribe gets a value from memory in _POST. This has to be done in the formail.php page itself but before the $body variable is built.
Printer Friendly | Permalink |  | Top
 
wtmusic Donating Member (1000+ posts) Send PM | Profile | Ignore Wed Oct-06-04 06:01 PM
Response to Reply #1
3. yes
Edited on Wed Oct-06-04 06:02 PM by wtmusic
In PHP 4.2.0 and later, the default value for the PHP directive register_globals is off. To emulate register_globals = on, insert this code at the top of your processing page:

foreach($_POST AS $key => $value) {
$$key = $value;
};

You will then have all the $_POST variables available as their form element names.
Printer Friendly | Permalink |  | Top
 
DS1 Donating Member (1000+ posts) Send PM | Profile | Ignore Wed Oct-06-04 06:04 PM
Response to Reply #3
5. I love that script
:7
Printer Friendly | Permalink |  | Top
 
apnu Donating Member (1000+ posts) Send PM | Profile | Ignore Wed Oct-06-04 06:04 PM
Response to Reply #3
6. that's way more nifty than my snippet. nice job!
Printer Friendly | Permalink |  | Top
 
DU AdBot (1000+ posts) Click to send private message to this author Click to view 
this author's profile Click to add 
this author to your buddy list Click to add 
this author to your Ignore list Tue Apr 23rd 2024, 05:40 AM
Response to Original message
Advertisements [?]
 Top

Home » Discuss » The DU Lounge Donate to DU

Powered by DCForum+ Version 1.1 Copyright 1997-2002 DCScripts.com
Software has been extensively modified by the DU administrators


Important Notices: By participating on this discussion board, visitors agree to abide by the rules outlined on our Rules page. Messages posted on the Democratic Underground Discussion Forums are the opinions of the individuals who post them, and do not necessarily represent the opinions of Democratic Underground, LLC.

Home  |  Discussion Forums  |  Journals |  Store  |  Donate

About DU  |  Contact Us  |  Privacy Policy

Got a message for Democratic Underground? Click here to send us a message.

© 2001 - 2011 Democratic Underground, LLC