473,511 Members | 16,282 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

need help with this

1 New Member
i am new to php and need some help. i have 2 pages one is html and other is .php

when i run the program it just spits out the code. i am stumped

here is the html file

<html>
<Head>
<title>Triangle</title>
</head>
<body>
<form action="triangle.php" method="POST">
<p>
sideone:<input type="text" name="a" />
sidetwo:<input type="text" name="b" />
sidethree:<input type="text" name="c" />
<input type="submit" />

</p>
</form>
</body>
</html>

here is the php


<html>
<head>
<title>Triangle</title>
</head>
<body>
<?php



function calculate($firstside,$secondside,$thirdside)
{

$firstside=$_POST["a"];
$secondside=$_POST["b"];
$thirdside=$_POST["c"];

$total = ($firstside + $secondside);


if ($total > $thirdside)
{
echo "(you have the correct side lengths)";
}
else
{
echo "(please re-enter the side lenghts)";
}
}

calculate("firstside","secondside","thirdside");


?>

</body>
</html>
Mar 29 '07 #1
1 1112
Motoma
3,237 Recognized Expert Specialist
What version of PHP and Apache do you have installed?
What OS are you using?

i am new to php and need some help. i have 2 pages one is html and other is .php

when i run the program it just spits out the code. i am stumped

here is the html file

<html>
<Head>
<title>Triangle</title>
</head>
<body>
<form action="triangle.php" method="POST">
<p>
sideone:<input type="text" name="a" />
sidetwo:<input type="text" name="b" />
sidethree:<input type="text" name="c" />
<input type="submit" />

</p>
</form>
</body>
</html>

here is the php


<html>
<head>
<title>Triangle</title>
</head>
<body>
<?php



function calculate($firstside,$secondside,$thirdside)
{

$firstside=$_POST["a"];
$secondside=$_POST["b"];
$thirdside=$_POST["c"];

$total = ($firstside + $secondside);


if ($total > $thirdside)
{
echo "(you have the correct side lengths)";
}
else
{
echo "(please re-enter the side lenghts)";
}
}

calculate("firstside","secondside","thirdside");


?>

</body>
</html>
Mar 29 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1301
by: kmunderwood | last post by:
How do I show only one Element with this code Help Me, OH!!! Help Me ;) I have code that works, but... This is the way it comes out in html The Level, or Element "v1"(background) turns red...
6
2552
by: Alfonso Morra | last post by:
I have written the following code, to test the concept of storing objects in a vector. I encounter two run time errors: 1). myClass gets destructed when pushed onto the vector 2). Prog throws a...
2
2156
by: atv | last post by:
Hi, is there something wrong with this code? It seems that it crashes at the else { clause, when allocating a second record. Excuse for the indentation, the g_warnings are from gtk. Also, i'm...
4
353
by: momo | last post by:
Hello all, I need help with this. I have a datagrid (dg1) with checkboxes and I want when some rows are selected to populate another datagrid (dg2) with the selected rows from (dg1). Thanks ...
0
1615
by: TN Bella | last post by:
Hi, I am trying to get my compare validator to fire properly...Since I have panels the validator wouldn't work properly, the app would fire right but would insert the data regardless and the...
4
3047
by: Maziar Aflatoun | last post by:
Hi everyone, I am working on the 'Delete' section of my program. What I need to do is query my database and for every ID that it finds I want to remove a file+ID.jpg from my file folder and...
2
1655
by: Merdelus | last post by:
I'm a new visual basic learner, I need some help with this program below: create an application that either sums or averagethe rows or columns of a two dimensional array depending on user...
2
1284
by: carly | last post by:
Hi......i need some help with this C program. I have created a array called "data" of 100 integers, im just having problems with writing the funtion call that will sort the 100 elements data through...
20
7177
by: fniles | last post by:
I am using VB.NET 2003, SQL 2000, and SqlDataReader. As I read data from tblA, I want to populate tblB. I use SQLDataReader for both tables. I do not use thread. When I ExecuteReader on tblB, I...
6
4379
by: Falcco | last post by:
Hi all, i have a sql scripts and i need to make new database based on this scripts but i dont know how, because this ist my "first meet" with this PostgreSQL. I need that for project to school,...
0
7245
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7144
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7356
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7512
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5069
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
1577
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
449
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.