globals


PHP form mail and register globals


I have a form and php processing file, and everything seems to be working fine except that the user-entered variables are not showing up in the emailed form results. From the research I've done (I'm beginner PHP), I'm guessing it's because my script uses HTTP_POST_VARS and my client's server has globals turned off? They recently switched from Godaddy Windows to Godaddy Linux hosting.
This is my processing file:
<?php
// where is your config file stored?
include ("ajaxSubmit.php");
// CLIENT INFORMATION
$Contactname = $HTTP_POST_VARS['Contactname'];
$email = $HTTP_POST_VARS['email'];
$Contacttitle = $HTTP_POST_VARS['Contacttitle'];
$Business = $HTTP_POST_VARS['Business'];
$Address = $HTTP_POST_VARS['Address'];
$City = $HTTP_POST_VARS['City'];
$State = $HTTP_POST_VARS['State'];
$Zip = $HTTP_POST_VARS['Zip'];
$Phone = $HTTP_POST_VARS['Phone'];
$Fax = $HTTP_POST_VARS['Fax'];
$product_desc = $HTTP_POST_VARS['product_desc'];
$delivery = $HTTP_POST_VARS['delivery'];
$sku = $HTTP_POST_VARS['sku'];
$annualturns = $HTTP_POST_VARS['annualturns'];
$seasonal = $HTTP_POST_VARS['seasonal'];
$minmaxpallet = $HTTP_POST_VARS['minmaxpallet'];
$avgpalletval = $HTTP_POST_VARS['avgpalletval'];
$avgpalletwt = $HTTP_POST_VARS['avgpalletwt'];
$maxpalletht = $HTTP_POST_VARS['maxpalletht'];
$casesperpallet = $HTTP_POST_VARS['casesperpallet'];
$unitweight = $HTTP_POST_VARS['unitweight'];
$reqlotnumctrl = $HTTP_POST_VARS['reqlotnumctrl'];
$freightclass = $HTTP_POST_VARS['freightclass'];
$hazardclass = $HTTP_POST_VARS['hazardclass'];
$barcodes = $HTTP_POST_VARS['barcodes'];
$avgupsfedex = $HTTP_POST_VARS['avgupsfedex'];
$avgorderweight = $HTTP_POST_VARS['avgorderweight'];
$ordersending = $HTTP_POST_VARS['ordersending'];
$custpickups = $HTTP_POST_VARS['custpickups'];
$flatfiles = $HTTP_POST_VARS['flatfiles'];
$shrinkwrap = $HTTP_POST_VARS['shrinkwrap'];
$repack = $HTTP_POST_VARS['repack'];
$specialreq = $HTTP_POST_VARS['specialreq'];
// MODIFY THE FOLLOWING SECTION
// your name
$recipientname = "Company X";
// your email
$recipientemail = "email#email.com";
// subject of the email sent to you
$subject = "Quote Request for $recipientname";
// send an autoresponse to the user?
$autoresponse = "yes";
// subject of autoresponse
$autosubject = "Thank you for your mail!";
// autoresponse message
$automessage = "Thanks for the message. We've successfully received your quote request and will get back to you shortly.";
// thankyou displayed after the user clicks "submit"
$thanks = "Thank you for contacting us. We will get back to you as soon as possible.";
// END OF NECESSARY MODIFICATIONS
// format message
$message = "Online-Form Response for $recipientname:
<br>
Contact Name: $Contactname
<br>
Business: $Business
<br>
Email: $email
<br>
Address: $Address
<br>
City: $City
<br>
State: $State
<br>
Zip: $Zip
<br>
Phone: $Phone
<br>
Fax: $Fax
<br>
<br>
<br>
Describe your product(s): $product_desc
<br>
How will your product be delivered?: $delivery
<br>
How many SKU's (items): $sku
<br>
How many turns per year?: $annualturns
<br>
Are your products seasonal?: $seasonal
<br>
Indicate minimum and Maximum pallet levels: $minmaxpallet
<br>
Average value per pallet: $avgpalletval
<br>
Weight of a typical pallet: $avgpalletwt
<br>
Maximum pallet stacking height: $maxpalletht
<br>
Cases per pallet? Or average case size?: $casesperpallet
<br>
Weight of each unit?: $unitweight
<br>
Do you require lot number control?: $reqlotnumctrl
<br>
What freight class?: $freightclass
<br>
Is the product hazardous? If so, what classifications?: $hazardclass
<br>
<br>
<br>
Do you need custom Barcodes made?: $barcodes
<br>
What is the average number of orders shipped via UPS/Fedex?: $avgupsfedex
<br>
What is the average order size in weight?: $avgorderweight
<br>
What is the average number of lines per order?: $avgorderlines
<br>
Will your orders be sent via E-mail, FAX, or other?: $ordersending
<br>
Will you have customer pick ups, and how often?: $custpickups
<br>
Can your company e-mail us flat files?: $flatfiles
<br>
Do your orders need to be shrink wrapped?: $shrinkwrap
<br>
Do you need repackaging?: $repack
<br>
Are there any special requirements that your company may have?: $specialreq
<br>";
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'From: Company X <email#email.com>' . "\r\n";
// send mail and print success message
mail($recipientemail, $subject, $message, $headers);
if($autoresponse == "yes") {
$autosubject = stripslashes($autosubject);
$automessage = stripslashes($automessage);
mail($email,"$autosubject","$automessage","From: $recipientname <$recipientemail>");
}
echo "<script language=\"JavaScript\" type=\"text/JavaScript\"> window.location.href = \"thanks_quote.php\";</script>";
?>
EDIT: I tested on another server (with globals on), and the form worked fine, but I'm not sure how to rewrite my script so that it does not rely on POST?
The HTTP_POST_VARS is now deprecated. Also register_globals is deprecated in 5.3.0 and above. So use $_POST instead of HTTP_POST_VARS.
Also, instead of last line:
echo "<script language=\"JavaScript\" type=\"text/JavaScript\"> window.location.href = \"thanks_quote.php\";</script>";
to redirect to another page, use:
header('Location: thanks_quote.php');

Related Links

PHP form mail and register globals
python globals dictionary

Categories

HOME
asp.net-web-api
beautifulsoup
telegram
webdriver
ecmascript-6
pagination
gpu
pyqt
static
fftw
jelastic
spring-data-redis
ado.net
frontend
crystal-lang
pkcs#11
jquery-ui-sortable
pega
gkturnbasedmatch
dynatrace
magnetic-cards
mongodb-csharp
dynamic-sql
mvc-mini-profiler
intershop
android-7.0-nougat
git-extensions
charles
simpleitk
symbols
blade
angular-routing
intersystems-cache
android-things
rpgle
bioinformatics
gp
carrierwave
aws-codecommit
mobx
cognos-bi
sql-server-2000
android-maps-extensions
instantiation
batching
fiware-cygnus
openerp-7
graphhopper
release
projects-and-solutions
demo
mongoose-schema
flask-login
plan-9
nanoc
context-switch
scalding
custom-font
semantic-logging
skin
pybrain
testrail
rmongo
flex-monkey
spring-cloud-feign
expectations
swizzling
mediametadataretriever
beanstalk
kendo-upload
asyncdisplaykit
vhosts
oracle-spatial
doctype
sha512
git-ftp
zend-currency
openbabel
mass-assignment
filesplitting
addressing-mode
big-ip
cbind
fpdi
amslidemenu
ecslidingviewcontroller
c++builder-xe5
mongohq
node-blade
pclzip
android-icons
stacky
sqlclr
web-notifications
curb
subgraph
fusefabric
josql
inkcanvas
dataform
luajava
objective-j
instantiationexception
easyb
scrollbars
dsl-tools
escrow
scrubyt
todos
sqlobject

Resources

Encrypt Message