0

I don't have a ton of php experience but I am trying to have math problem echoed in the same browswer screen upon submit. Problem is when I submit nothing appears it just looks like i refreshed the page. I've tried moving the php coding into a seperate .php file so the form can call it. the same thing happens though. Do I need to be connected to Wamp so php can work? I'm not calling mysql or anything.

6
Contributors
14
Replies
15
Views
7 Years
Discussion Span
Last Post by RazorRamon
0

The PHP file must be in the root folder ("C:\Program Files\wamp\www\" maybe?) and WAMP (Apache server, to be exact) must be on. Then run it with "http://localhost/math_file.php" in your browser.

If this doesn't work, paste your code here within [.code][./code] tags. It might have something to do with your source code.

0

if you're using wamp server just enable display errors in php settings in order for you to be prompted with an error message, so as for you to determine the error.

0

pricing.htm

<div id="para">

<form method="post" action="pricing.php">

<textarea name="pages" value="" rows="1" cols="5"/>
</textarea>

Pictures<input type="radio" name="pictures" value="50">
<input type="radio" name="pictures" value="25" checked>
<input type="radio" name="pictures" value="0"><br>

Literature<input type="radio" name="literatures" value="100">
<input type="radio" name="literatures" value="50" checked>
<input type="radio" name="literatures" value="0"><br>
<br>


Pictures<input type="checkbox" name="picture value="50" ><br>
Page<input type="checkbox" name="literature" value="50" ><br>
Contact Form<input type="checkbox" name="contact" value="100" ><br>

<input type="submit" name="go" value="Calculate" />
</form>

</div>

pricing.php

<html>
<body>

 
<?php

$pages=$_REQUEST['pages'];
$pictures=$_REQUEST['pictures'];
$literatures=$_REQUEST['literatures'];
$picture=$_REQUEST['picture'];
$literature=$_REQUEST['literature'];
$contact=$_REQUEST['contact'];
$total=($pages*$pictures)+($pages*$picture)+($pages*$literatures)+
             ($pages*$literature)+$contact;

echo $total;
?>

</body>

</html>

I hasn't worked at all I even tried to echo $pages and it still doesn't work.

0

Yes, I also agree with britoniah and flamer here. Hope posting $_POST can solve your problem immediately. Please try this and let us know what happened.

0

pricing.htm

<div id="para">

<form method="post" action="pricing.php">

<textarea name="pages" value="" rows="1" cols="5"/>
</textarea>

Pictures<input type="radio" name="pictures" value="50">
<input type="radio" name="pictures" value="25" checked>
<input type="radio" name="pictures" value="0"><br>

Literature<input type="radio" name="literatures" value="100">
<input type="radio" name="literatures" value="50" checked>
<input type="radio" name="literatures" value="0"><br>
<br>


Pictures<input type="checkbox" name="picture value="50" ><br>
Page<input type="checkbox" name="literature" value="50" ><br>
Contact Form<input type="checkbox" name="contact" value="100" ><br>

<input type="submit" name="go" value="Calculate" />
</form>

</div>

pricing.php

<html>
<body>

 
<?php

$pages=$_REQUEST['pages'];
$pictures=$_REQUEST['pictures'];
$literatures=$_REQUEST['literatures'];
$picture=$_REQUEST['picture'];
$literature=$_REQUEST['literature'];
$contact=$_REQUEST['contact'];
$total=($pages*$pictures)+($pages*$picture)+($pages*$literatures)+
             ($pages*$literature)+$contact;

echo $total;
?>

</body>

</html>

I hasn't worked at all I even tried to echo $pages and it still doesn't work.

It si good to RTM,
that being said it is not recommended to use request as it will pick contents of $_POST, $_GET, $_COOKIE. So be explicit to avoid problems. So just use $_POST/GET
Post being recommended! See Manual

0

It si good to RTM,
that being said it is not recommended to use request as it will pick contents of $_POST, $_GET, $_COOKIE. So be explicit to avoid problems. So just use $_POST/GET
Post being recommended! See Manual

That's a good point there. Thanks for the further explanation :)

0

could it be a problem with WAMP? I recently got rid of a site i built in there. Did I delete something i shouldn't have? if so how do i fix it? uninstall and reinstall?

0

I dont know what else it could be

Edited by RazorRamon: n/a

0

wait, its not the WAMP maybe, (or if you still have doubts why don't you reinstall it?)
did you tried changing $_REQUEST to $_POST??

0

If you want to know if it is server issue or not try to make PHP file and access it on Url and in the PHP file put just the simple code below

<?php phpinfo();?>
0

It was wamp. I had deleted some of the files that were in there. I uninstalled and reinstalled the entire wamp program and php worked when i tested it in there. Thanks everybody for your help!!!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.