Jump to content

Why arent my variables being passed?


iheartlinus

Recommended Posts

So I am using PHP for a four step process. The first step is the user inputting info into a calculator, the second step is that it shows them the calculated total and displays a link to the third step, which is where they enter the contact information and press submit, and then they are redirected to the home page (4th step)

 

The third step is where I am stuck. For some reason the variables are not getting passed from the first form (calculator) to the second form (contact info) and submitted to me. In the email that I am getting I receive the contact info, but none of the calculator info, so I'm assuming my variables are not getting passed?

 

First Step:

 

<form enctype="multipart/form-data" method="post" form action="<?php echo $_SERVER['PHP_SELF']; ?>?submit=true">

<p class="formdesign">

<label for="name"></label>

</p>

<p class="formdesign">

<label for="email"></label>

</p>

<p class="formdesign">How many pages do you estimate your site will need?

</p>

<p>

<span class="formdesign">

<label>

<input type="checkbox" name="one" value="375" id="one">

Up to 5 pages</label>

<br>

<label>

<input type="checkbox" name="two" value="575" id="two">

Up to 10 Pages</label>

<br>

<label>

<input type="checkbox" name="three" value="775" id="three">

Up to 15 Pages</label>

<br>

</span></p>

<p class="formdesign">Will you be selling items on your Website?</p>

<p>

<span class="formdesign">

<input type="checkbox" name="four" value="250" />

Yes

<input type="checkbox" name="five" value="0"/> No</span></p>

 

<p class="formdesign">Would like to be able to update the site yourself?</p>

<p class="footnote">*If you will be selling items skip this step, as all e-commerce sites include a content management system.</p>

<p>

<span class="formdesign">

<input type="checkbox" name="six" value="150" />

Yes

<input type="checkbox" name="seven" value="0"/> No</span></p>

 

<p class="formdesign">Will your site need any of the following?</p>

<p>

 

<span class="formdesign">

<label>

<input type="checkbox" name="eight" value="25" id="eight" >

Audio/Video Player</label>

<br>

<label>

<label>

<input type="checkbox" name="nine" value="50" id="nine">

Flash Intro</label>

<br>

<label>

<input type="checkbox" name="ten" value="25" id="ten">

Photo Gallery/Slideshow</label>

<br>

</span></p>

<p><span class="formdesign">

Will you need any of the following?

<label>

<br>

<br>

<input type="checkbox" name="eleven" value="50" id="eleven">

Logo/Graphic Design</label>

<br>

<label>

<input type="checkbox" name="twelve" value="50" id="twelve">

Copy (Words)</label>

<br>

<label>

<input type="checkbox" name="thirteen" value="25" id="thirteen">

Images</label>

</span><br>

</p>

<input type="submit" value="Price" >

</p>

</form>

</div>

<map name="newdesignMap" id="newdesignmap">

<area shape="rect" coords="271,94,335,128" href="work.html" alt="work"/>

<area shape="rect" coords="357,93,442,130" href="pricing.html" alt="pricing"/>

<area shape="rect" coords="465,90,523,133" href="faq.html" alt="faq"/>

<area shape="rect" coords="540,92,637,132" href="designer.html" alt="designer"/>

<area shape="rect" coords="652,93,747,134" href="contact.html" alt="contact"/>

<area shape="rect" coords="761,95,966,134" href="word.html" alt="word"/>

<area shape="rect" coords="715,31,976,71" href="mailto:[email protected]" alt="email"/>

<area shape="rect" coords="305,708,349,721" href="work.html" alt="work"/>

<area shape="rect" coords="360,708,413,726" href="pricing.html" alt="pricing"/>

<area shape="rect" coords="424,711,458,722" href="faq.html" alt="faq"/>

<area shape="rect" coords="471,708,529,725" href="designer.html" alt="designer"/>

<area shape="rect" coords="541,709,599,723" href="contact.html" alt="contact"/>

<area shape="rect" coords="608,708,685,723" href="#" alt="sitemap"/>

</map>

</div>

<div class="text" id="result">

<?php

$submit = $_GET['submit'];

if($submit == "true")

{

$total = ($_POST['one'] + $_POST['two'] + $_POST['three'] + $_POST['four'] + $_POST['five'] + $_POST['six'] + $_POST['seven'] + $_POST['eight']+ $_POST['nine'] + $_POST['ten']+ $_POST['eleven'] + $_POST['twelve']+ $_POST['thirteen']);

echo " Your Price is \$ " .number_format ($total, 2, '.', ','). "<BR>";

echo ('<a href="http://designs.com/projectrequest.… Your Project Started </a>');

}

?>

</div>

</body>

</html>

 

 

 

Second Page:

 

<?php

session_start();

$submit = $_GET['submit'];

if($submit == "true")

{

header("Location: http://designs.com");

$to = "[email protected]";

$message = "Pages:\t$_POST[one]\n";

$message .= "Logo:\t$_POST[two]\n"; :shrug:

Link to comment
https://forums.phpfreaks.com/topic/167307-why-arent-my-variables-being-passed/
Share on other sites

I did a little modification to your code its not the best lol an  havent test it, but it suppose to work fine, just add other input fields an the mail() function

 

 



<form method="post" form action="<?php echo $_SERVER['PHP_SELF']; ?>?submit=true">
<p class="formdesign">
<label for="name"></label>
</p>
<p class="formdesign">
<label for="email"></label>
</p>
<p class="formdesign">How many pages do you estimate your site will need?
</p>
<p>
<span class="formdesign">
<label>
<input type="checkbox" name="one" value="375" id="one">
Up to 5 pages</label>
<br>
<label>
<input type="checkbox" name="two" value="575" id="two">
Up to 10 Pages</label>
<br>
<label>
<input type="checkbox" name="three" value="775" id="three">
Up to 15 Pages</label>
<br>
</span></p>
<p class="formdesign">Will you be selling items on your Website?</p>
<p>
<span class="formdesign">
<input type="checkbox" name="four" value="250" />
Yes
<input type="checkbox" name="five" value="0"/> No</span></p>

<p class="formdesign">Would like to be able to update the site yourself?</p>
<p class="footnote">*If you will be selling items skip this step, as all e-commerce sites include a content management system.</p>
<p>
<span class="formdesign">
<input type="checkbox" name="six" value="150" />
Yes
<input type="checkbox" name="seven" value="0"/> No</span></p>

<p class="formdesign">Will your site need any of the following?</p>
<p>

<span class="formdesign">
<label>
<input type="checkbox" name="eight" value="25" id="eight" >
Audio/Video Player</label>
<br>
<label>
<label>
<input type="checkbox" name="nine" value="50" id="nine">
Flash Intro</label>
<br>
<label>
<input type="checkbox" name="ten" value="25" id="ten">
Photo Gallery/Slideshow</label>
<br>
</span></p>
<p><span class="formdesign">
Will you need any of the following?
<label>
<br>
<br>
<input type="checkbox" name="eleven" value="50" id="eleven">
Logo/Graphic Design</label>
<br>
<label>
<input type="checkbox" name="twelve" value="50" id="twelve">
Copy (Words)</label>
<br>
<label>
<input type="checkbox" name="thirteen" value="25" id="thirteen">
Images</label>
</span><br>
</p>
<input type="submit" name="submit" value="Price" >
</p>
</form>
</div>
<map name="newdesignMap" id="newdesignmap">
<area shape="rect" coords="271,94,335,128" href="work.html" alt="work"/>
<area shape="rect" coords="357,93,442,130" href="pricing.html" alt="pricing"/>
<area shape="rect" coords="465,90,523,133" href="faq.html" alt="faq"/>
<area shape="rect" coords="540,92,637,132" href="designer.html" alt="designer"/>
<area shape="rect" coords="652,93,747,134" href="contact.html" alt="contact"/>
<area shape="rect" coords="761,95,966,134" href="word.html" alt="word"/>
<area shape="rect" coords="715,31,976,71" href="mailto:[email protected]" alt="email"/>
<area shape="rect" coords="305,708,349,721" href="work.html" alt="work"/>
<area shape="rect" coords="360,708,413,726" href="pricing.html" alt="pricing"/>
<area shape="rect" coords="424,711,458,722" href="faq.html" alt="faq"/>
<area shape="rect" coords="471,708,529,725" href="designer.html" alt="designer"/>
<area shape="rect" coords="541,709,599,723" href="contact.html" alt="contact"/>
<area shape="rect" coords="608,708,685,723" href="#" alt="sitemap"/>
</map>
</div>
<div class="text" id="result">
<?php


$submit = $_POST['submit'];
$logos = $_POST['logos'];
$pages = $_POST['pages'];
$contactinfo = $_POST['contactinfo'];

$submit2 = $_POST['submit2']; /// this execute the email form after the person fill out the form with his/her info

if(isset($submit2))
{
session_start();

header("Location: http://designs.com");
$to = "[email protected]";
$message = "Contact info : $contactinfo\n";
$message = "Pages:\t$pages\n";
$message .= "Logo:\t$logos\n";

}

if(isset($submit))
{
$total = ($_POST['one'] + $_POST['two'] + $_POST['three'] + $_POST['four'] + $_POST['five'] + $_POST['six'] + $_POST['seven'] + $_POST['eight']+ $_POST['nine'] + $_POST['ten']+ $_POST['eleven'] + $_POST['twelve']+ $_POST['thirteen']);
echo " Your Price is \$ " .number_format ($total, 2, '.', ','). "<BR>";
echo '<a href="http://designs.com/projectrequest">Your Project Started </a>';

echo "<form action='' method='post'>";
echo "Your Contact<br/><input type='text' name='contactinfo'><br/>";


echo "<input type='hidden' value='$_POST[one]' name='pages'>"; /// Captures the pages value from the calculator
echo "<input type='hidden' value='$_POST[two]' name='logos'>"; /// Captures the logos value from the calculator

echo "<input type='submit' name='submit2' value='Send'>";
echo "</form>";

}
?>
</div>
</body>
</html>


Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.