FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » display two values on page
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
display two values on page [message #181130] Thu, 18 April 2013 09:44 Go to previous message
newbie php is currently offline  newbie php
Messages: 3
Registered: April 2013
Karma:
Junior Member
Hi all,
I'm an absolute newbie to PHP, but I need to send two values to a php-page and multiplay to calculate costs for an order.
Simplified, i have a form that sends number and price to calculate.php.
code:
<form name="form" method="post" action="calculate.php">
<table border="0" cellspacing="5" cellpadding="10">
<tr>
<td>tickets</td>
<td><select name="number">
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4>4</option>
<option value=5>5</option>
<option value=6>6</option>
<option value=7>7</option>
<option value=8>8</option>
<option value=9>9</option>
<option value=10>10</option>
</select></td>
</tr>

<tr>
<td>&nbsp;</td>
<td><input type="submit" name="button" id="button" value="calculate"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table><input name="price" type="hidden" value=6>
</form>

So the form sends the chosen number and the hidden value of 6 to calculate.php

Calculate php maltiplies both values. In code:

<html>
<head>Cost calculated</head>
<body>

<?php
$p=$_POST[price];
$n=$_POST[number];
$kosten = $p * $n;

echo $a "<br>"
echo $p "<br>"
echo $kosten "<br>"

?>

</body>
</html>

However, this results in a server-error.

Please, anybody, where do I go wrong?

Sybolt
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Anyone uses vTiger's webservice? I need help with webservice's response
Next Topic: Help with searching arrays of objects
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 11:49:45 GMT 2024

Total time taken to generate the page: 0.04686 seconds