Trouble with writting global vars to...

User 463868 Photo


Registered User
89 posts

I finally have a form up and working, it is posting to the database. The files are being written to the files directory just as it suppose to, although not forwarding the attchment to me yet :-/
But that is not why I'm writting. The problem is I'm trying to access the global vars after the post to put the information obtained using the form. I assign them to local vars using $Name = $_POST['Name']; ect... but when I try to write to the screen nothing shows up.
If you are good with using the CCForms and php if you would take a look at hogansbassets.com/CustomShotRecord.html I would appreciateany help with it.
Thanks Jon
hogansbassets.com
eagleeye360.com
freight360.us
User 463868 Photo


Registered User
89 posts

Additional information, before trying to assign the global $_POST[..] fields I just used text strings and the page worked perfect and put everything exactly where I wanted it to be. So it has something to do with the PHP. I'm Just not sure what it is. I am assigning the vars to local vars so I can remove the preformated text from the CCforms POST if user did not enter anything in the field.
hogansbassets.com
eagleeye360.com
freight360.us
User 463868 Photo


Registered User
89 posts

And if you have trouble getting the code here is the page source.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<!-- Notice this is all in the HEAD of the document before the BODY starts -->

<?php $Name = $_POST['Name'];
$Birthday = $_POST['Birthdate'];
$WelpingDate = $_POST['WelpingDate'];
$Registration = $_POST['Registration'];
$Owner = $_POST['Owner'];
$Address = $_POST['Address1'];
$Phone = $_POST['Phone'];
$EMail = $_POST['EMail'];

if $_POST['CB1'] == true{
$I1 = $_POST['I1']};
else{ $I1 == ''};

if $_POST['CB2'] == true{
$I2 = $_POST['I2']};
else{ $I1 == '' };

if $_POST['CB3'] == true{
$I3 = $_POST['I3']};
else{ $I1 == '' };

if $_POST['CB4'] == true{
$I4 = $_POST['I4']};
else{ $I1 == '' };

if $_POST['CB5'] == true{
$I5 = $_POST['I5']};
else{ $I1 == '' };

if $_POST['CB6'] == true{
$I6 = $_POST['I6']};
else{ $I1 == '' };

if $_POST['CB7'] == true{
$I7 = $_POST['I7']};
else{ $I1 == '' };

if $_POST['CB8'] == true{
$I8 = $_POST['I8']};
else{ $I1 == '' };

if $_POST['CB9'] == true{
$I9 = $_POST['I9']};
else{ $I1 == '' };

if $_POST['CB10'] == true{
$I10 = $_POST['I10']};
else{ $I1 == '' };

$Upload = $_POST['Uploaded_File']; ?>

<style type="text/css">
#CustomForm{
position: absolute;
top: 0px;
left: 50px;
height: 733px;
width: 908px;
background-image:url('ShotRecordBackground.png');
z-index: 1;
}
#MyHeaderTitle{
color: black;
font-family:'ArgentumShine';
position: absolute;
top: 9px;
left: 340px;
height: auto;
width: auto;
z-index: 2;
}
#MySubHeaderTitle{
color: black;
font-family: arial;
font-weight: bold;
font-size: 10pt;
position: absolute;
top: 30px;
left: 425px;
height: auto;
width: auto;
z-index: 2;
}
#CustomName{
color: black;
font-family: arial;
font-weight: bold;
font-size: 8pt;
position: absolute;
top: 31px;
left: 135px;
height: auto;
width: auto;
z-index: 2;
}
#CustomBirthdate{
color: black;
font-family: arial;
font-weight: bold;
font-size: 8pt;
position: absolute;
top: 47px;
left: 135px;
height: auto;
width: auto;
z-index: 2;
}
#CustomWelpingdate{
color: black;
font-family: arial;
font-weight: bold;
font-size: 8pt;
position: absolute;
top: 62px;
left: 135px;
height: auto;
width: auto;
z-index: 2;
}
#CustomRegid{
color: black;
font-family: arial;
font-weight: bold;
font-size: 8pt;
position: absolute;
top: 77px;
left: 135px;
height: auto;
width: auto;
z-index: 2;
}
#CustomOwnerName{
color: black;
font-family: arial;
font-weight: bold;
font-size: 8pt;
position: absolute;
top: 31px;
left: 800px;
height: auto;
width: auto;
z-index: 2;
}
#CustomAddress{
color: black;
font-family: arial;
font-weight: bold;
font-size: 8pt;
position: absolute;
top: 47px;
left: 800px;
height: auto;
width: auto;
z-index: 2;
}
#CustomPhone{
color: black;
font-family: arial;
font-weight: bold;
font-size: 8pt;
position: absolute;
top: 62px;
left: 800px;
height: auto;
width: auto;
z-index: 2;
}
#CustomEmail{
color: black;
font-family: arial;
font-weight: bold;
font-size: 8pt;
position: absolute;
top: 77px;
left: 800px;
height: auto;
width: auto;
z-index: 2;
}
#Photobox{
position: absolute;
top: 121px;
left: 575px;
height: 215px;
width: 380px;
background-image:inherit; <!-- Upload img -->
z-index: 1;
}
#CustomDate1{
color: black;
font-family: arial;
font-weight: bold;
font-size: 7pt;
position: absolute;
top: 155px;
left: 65px;
height: auto;
width: auto;
z-index: 2;
}
#Custom6WDHPPVCV{
color: black;
font-family: arial;
font-weight: bold;
font-size: 7pt;
position: absolute;
top: 155px;
left: 135px;
height: auto;
width: auto;
z-index: 2;
}
#CustomDate2{
color: black;
font-family: arial;
font-weight: bold;
font-size: 7pt;
position: absolute;
top: 170px;
left: 65px;
height: auto;
width: auto;
z-index: 2;
}
#Custom6WHWFLEATICK{
color: black;
font-family: arial;
font-weight: bold;
font-size: 7pt;
position: absolute;
top: 170px;
left: 135px;
height: auto;
width: auto;
z-index: 2;
}
#CustomDate3{
color: black;
font-family: arial;
font-weight: bold;
font-size: 7pt;
position: absolute;
top: 186px;
left: 65px;
height: auto;
width: auto;
z-index: 2;
}
#Custom9WDHPPVCV{
color: black;
font-family: arial;
font-weight: bold;
font-size: 7pt;
position: absolute;
top: 186px;
left: 135px;
height: auto;
width: auto;
z-index: 2;
}
#CustomDate4{
color: black;
font-family: arial;
font-weight: bold;
font-size: 7pt;
position: absolute;
top: 201px;
left: 65px;
height: auto;
width: auto;
z-index: 2;
}
#Custom9WHWFLEATICK{
color: black;
font-family: arial;
font-weight: bold;
font-size: 7pt;
position: absolute;
top: 201px;
left: 135px;
height: auto;
width: auto;
z-index: 2;
}
#CustomDate5{
color: black;
font-family: arial;
font-weight: bold;
font-size: 7pt;
position: absolute;
top: 217px;
left: 65px;
height: auto;
width: auto;
z-index: 2;
}
#Custom12WDHPPVCV{
color: black;
font-family: arial;
font-weight: bold;
font-size: 7pt;
position: absolute;
top: 217px;
left: 135px;
height: auto;
width: auto;
z-index: 2;
}
#CustomDate6{
color: black;
font-family: arial;
font-weight: bold;
font-size: 7pt;
position: absolute;
top: 232px;
left: 65px;
height: auto;
width: auto;
z-index: 2;
}
#Custom12WBordetella{
color: black;
font-family: arial;
font-weight: bold;
font-size: 7pt;
position: absolute;
top: 232px;
left: 135px;
height: auto;
width: auto;
z-index: 2;
}
#CustomDate7{
color: black;
font-family: arial;
font-weight: bold;
font-size: 7pt;
position: absolute;
top: 247px;
left: 65px;
height: auto;
width: auto;
z-index: 2;
}
#Custom12WHWFLEATICK{
color: black;
font-family: arial;
font-weight: bold;
font-size: 7pt;
position: absolute;
top: 247px;
left: 135px;
height: auto;
width: auto;
z-index: 2;
}
#CustomDate8{
color: black;
font-family: arial;
font-weight: bold;
font-size: 7pt;
position: absolute;
top: 263px;
left: 65px;
height: auto;
width: auto;
z-index: 2;
}
#Custom15WParvo{
color: black;
font-family: arial;
font-weight: bold;
font-size: 7pt;
position: absolute;
top: 263px;
left: 135px;
height: auto;
width: auto;
z-index: 2;
}
#CustomDate9{
color: black;
font-family: arial;
font-weight: bold;
font-size: 7pt;
position: absolute;
top: 278px;
left: 65px;
height: auto;
width: auto;
z-index: 2;
}
#Custom15WRabies{
color: black;
font-family: arial;
font-weight: bold;
font-size: 7pt;
position: absolute;
top: 278px;
left: 135px;
height: auto;
width: auto;
z-index: 2;
}
#CustomDate10{
color: black;
font-family: arial;
font-weight: bold;
font-size: 7pt;
position: absolute;
top: 293px;
left: 65px;
height: auto;
width: auto;
z-index: 2;
}
#Custom15WHWFLEATICK{
color: black;
font-family: arial;
font-weight: bold;
font-size: 7pt;
position: absolute;
top: 293px;
left: 135px;
height: auto;
width: auto;
z-index: 2;
}


#textbox{
position: absolute;
top: 360px;
left: 105px;
height: auto;
width: auto;
border-style: solid;
border-style: ridge;
z-index: 2;
}
p {
color: red;
font-family: arial, ArgentumShine;
font-weight: normal;
font-size: 12pt;
margin: 2px;
text-align: center;
}
</style>
</head>
<body>
<!-- Create Custom Form and Header -->
<div id="CustomForm"></div>
<div id="MyHeaderTitle">HOGAN'S BASSETS.COM</div>
<div id="MySubHeaderTitle"><i>Custom Shot Record</i></div>
<!-- Dog ID's -->
<div id="CustomName"><?php echo $Name; ?></div>
<div id="CustomBirthdate"><?php echo $Birthdate; ?></div>
<div id="CustomWelpingdate"><?php echo $WelpingDate; ?></div>
<div id="CustomRegid"><?php echo $Registration; ?></div>
<!-- Owner ID's -->
<div id="CustomOwnerName"><?php echo $Owner; ?></div>
<div id="CustomAddress"><?php echo $Address; ?></div>
<div id="CustomPhone"><?php echo $Phone; ?></div>
<div id="CustomEmail"><?php echo $EMail; ?></div>
<!-- Photo Posted -->
<div id="Photobox"><?php echo $Upload; ?></div>
<!-- Post Vacinations -->
<div id="CustomDate1"><?php echo $I1; ?></div>
<div id="Custom6WDHPPVCV">6 Week-DHP-PV-CV</div>
<div id="CustomDate2"><?php echo $I2; ?></div>
<div id="Custom6WHWFLEATICK">Heartworm/Flea/Tick</div>
<div id="CustomDate3"><?php echo $I3; ?></div>
<div id="Custom9WDHPPVCV">9 Week-DHP-PV-CV</div>
<div id="CustomDate4"><?php echo $I4; ?></div>
<div id="Custom9WHWFLEATICK">Heartworm/Flea/Tick</div>
<div id="CustomDate5"><?php echo $I5; ?></div>
<div id="Custom12WDHPPVCV">12 Week-DHP-PV-CV</div>
<div id="CustomDate6"><?php echo $I6; ?></div>
<div id="Custom12WBordetella">12 Week-Bordetella</div>
<div id="CustomDate7"><?php echo $I7; ?></div>
<div id="Custom12WHWFLEATICK">Heartworm/Flea/Tick</div>
<div id="CustomDate8"><?php echo $I8; ?></div>
<div id="Custom15WParvo">15 Week-Parvo</div>
<div id="CustomDate9"><?php echo $I9; ?></div>
<div id="Custom15WRabies">15 Week-Rabies</div>
<div id="CustomDate10"><?php echo $I10; ?></div>
<div id="Custom15WHWFLEATICK">Heartworm/Flea/Tick</div>
<!-- <div id="textbox"><p>This is text in a sizeable box</p></div> -->
</body>
</html>
hogansbassets.com
eagleeye360.com
freight360.us
User 463868 Photo


Registered User
89 posts

I'll give an example: this line <div id="CustomName"><?php echo $Name; ?></div>
If I change it to hard coding <div id="CustomName">Mr. Hogan</div>
then the code works perfect. This is the Global vars from a CCform that was just submited and stored in the DB and echoed to the owner of the form through EMail. I just need to take the info from the form and place it over a pregenerated form (as to fill it out). And from what I've read <?php echo $Name;?> is the same as not assigning the globals and just doing <?php echo $_POST['Name'];?> so not sure what it is.
This thread could also be under the WebForms forum.
hogansbassets.com
eagleeye360.com
freight360.us
User 463868 Photo


Registered User
89 posts

Tried using the $_REQUEST Function in php rather than the $_POST, didn't help :-(
I keep reading at W3Schools.com but running out of ideas...ahhhrrrggg
hogansbassets.com
eagleeye360.com
freight360.us
User 117361 Photo


Ambassador
6,076 posts

Jon...looks like you are talking a lot to yourself in here!!!
:)
User 463868 Photo


Registered User
89 posts

Consider this thread solved, CC web form builder doesn't pass the global $_POST to your next page.
hogansbassets.com
eagleeye360.com
freight360.us

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.