Battle Zone
We think you should log in. Don't you?


This is the site for everything and anything you want to talk about. Want to discuss the latest games? Done. Want to have fun? Done. This is THE place to have a great time.
 
HomePortalFAQMemberlistRegisterLog in

Share | 
 

 help me please!!!!

View previous topic View next topic Go down 
AuthorMessage
Night Angel
FRESH MEAT
avatar

Join date : 2010-03-10
Posts : 10


PostSubject: help me please!!!!   Fri Mar 12, 2010 9:33 am

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
   <title>Example 22b
   </title>
</head>
<body>
<?php
   $x=$_POST['number1'];
   $y=$_POST['number2'];
   $a=$_POST['radio'];
      if($a==add){
         $z=$x+$y;
         echo $x."+".$y."=".$z;
         }
         elseif($a==sub){
            $z=$x-$y;
            echo $x."-".$y."=".$z;
            }
         elseif($a==multiply){
            $z=$x*$y;
            echo $x."x".$y."=".$z;
            }
         else($a==divide){
            $z=$x/$y;
            echo $x."/".$y."=".$z;
            }
?>
</body>
</html>


Last edited by Vassago on Fri Mar 12, 2010 11:43 am; edited 1 time in total (Reason for editing : redid)
Back to top Go down
http://bbrhds21@gmail.com
Old Amsterdam
Bow Before Thy Master
Bow Before Thy Master
avatar

Join date : 2010-03-04
Rank : Head Admin / Site Owner

Posts : 7269


PostSubject: Re: help me please!!!!   Fri Mar 12, 2010 9:42 am

Post up your first page as well. The one with the form. I can't help unless I see that page as well. Just edit it in.

_________________
As authors, it is our Duty
To create lovable, enticing Characters
And do horrible, evil things to Them.

Back to top Go down
http://battlezone.forumotion.net/
Night Angel
FRESH MEAT
avatar

Join date : 2010-03-10
Posts : 10


PostSubject: here is the first half   Fri Mar 12, 2010 11:28 am

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
   <title>Example 22a
   </title>
</head>
<body>
   <form method="post" action="020910_22b.php">
      Enter #1 <input type="text" name="number1" /><br/>
       <br/>
      Enter #2 <input type="text" name="number2" /><br/>
       <br/>
      Add <input type="radio" name="rad"  value="add"/><br/>
       <br/>
      Subtract <input type="radio" name="rad" value="sub" /><br/>
       <br/>
      Multiply <input type="radio" name="rad" value="multiply" /><br/>
       <br/>
      Divide <input type="radio" name="rad" value="divide" /><br/>
       <br/>
      <input type="submit" value="Submit"/>
   </form>
</body>
</html>
Back to top Go down
http://bbrhds21@gmail.com
Old Amsterdam
Bow Before Thy Master
Bow Before Thy Master
avatar

Join date : 2010-03-04
Rank : Head Admin / Site Owner

Posts : 7269


PostSubject: Re: help me please!!!!   Fri Mar 12, 2010 11:45 am

First off, you need to change
Code:
  $a=$_POST['radio'];
  $b=$_POST['radio'];
  $c=$_POST['radio'];
  $d=$_POST['radio'];

to

Code:
$a=$_POST['rad'];

Those other variables aren't needed. Next, you'll need to do an IF, ELSEIF, ELSEIF, and ELSE to find out if $a == add/sub/multiply/divide. To do this, I'd change all of your values to numbers, that way you won't need to worry about quotes in the results page's code. I'd set them to 1,2,3,and 4 respectively. Then, in the IF, you see if it equals 1, if it does, you set a variable (for example, $operation) to equal $x + $y to add the two numbers ($x and $y). If it equals 2 (the first ELSEIF), then you do the same thing, except the $operation == $x - $y. Or if it equals 3 (the second ELSEIF) you have $operation == $x times $y to multiply them. Finally, if it equals 4, $operations == $x / $y.

Code:

if ($a == 1)
-----------
elseif ($a == 2)
------------
elseif ($z == 3)
------------
else

For example, for how I'd set it all up.

_________________
As authors, it is our Duty
To create lovable, enticing Characters
And do horrible, evil things to Them.

Back to top Go down
http://battlezone.forumotion.net/
Mozzie
OHNOES!!!!!!!!!!!!!!
avatar

Join date : 2010-03-04
Rank : Ex Staff

Posts : 5071


PostSubject: Re: help me please!!!!   Fri Mar 12, 2010 11:50 am

WOW!! is this Math? Variables, $ times to..multiply to...blah, blah, blah.. WOW!!! Crazy Nuts

Anyway, what's with this Rain? I don't get a problem like this but what's caused this problem for others?
Back to top Go down
http://www.wkyc.com/weather/severe_weather/cancellations_closing
Lone Wolf
I am such a post-wh*re and I am proud of it.
avatar

Join date : 2010-03-09
Rank : Technical Admin / Webmaster

Posts : 2523


PostSubject: Re: help me please!!!!   Sat Mar 13, 2010 9:07 pm

Yeah and I don't get none of it either so I can't help

_________________
There are so many people out there who say, "You can't."
What you have to do is turn around and say, "Watch me."
Back to top Go down
Old Amsterdam
Bow Before Thy Master
Bow Before Thy Master
avatar

Join date : 2010-03-04
Rank : Head Admin / Site Owner

Posts : 7269


PostSubject: Re: help me please!!!!   Tue Mar 16, 2010 9:51 am

It isn't for the site, it's for our programming class. I wouldn't expect it to make sense to you guys.

_________________
As authors, it is our Duty
To create lovable, enticing Characters
And do horrible, evil things to Them.

Back to top Go down
http://battlezone.forumotion.net/
DareDevil
Shamu Victim
avatar

Join date : 2010-03-09
Rank : Tentative

Posts : 2712


PostSubject: Re: help me please!!!!   Wed Mar 24, 2010 1:39 pm

Hey I did some of this in programming!
Back to top Go down
Old Amsterdam
Bow Before Thy Master
Bow Before Thy Master
avatar

Join date : 2010-03-04
Rank : Head Admin / Site Owner

Posts : 7269


PostSubject: Re: help me please!!!!   Tue Mar 30, 2010 9:56 am

Probably nothing like what we do, though. Our school's programming class is probably way beneath what we learn here at this school.

_________________
As authors, it is our Duty
To create lovable, enticing Characters
And do horrible, evil things to Them.

Back to top Go down
http://battlezone.forumotion.net/
Sponsored content




PostSubject: Re: help me please!!!!   

Back to top Go down
 

help me please!!!!

View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Battle Zone :: Extra! Extra! :: Random-
Jump to: