Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: php help  (Read 3293 times)

0 Members and 1 Guest are viewing this topic.

T-Chai

  • Guest
php help
« on: July 13, 2006, 02:43:24 PM »
I am just starting today learning php but i come across some problem that some of you may be able to explain:

Here the code
Quote
<?php
$any = 5;
$money = 200;
$Day = 1;
$respect = 0;
$caliorg = "Californai Orange";
$caliorg_price = 25.00;
$nothern = "northen light";
$nothern_price = 22.50;
?>
<body bgcolor="#CCCCCC"><form name="form1" method="post" action="">
  <table width="200" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td align="left" valign="middle" bgcolor="#FFFFFF"><?php echo "£ ", $money ?></td>
      <td align="left" valign="middle" bgcolor="#FFFFFF"><?php echo "Days ", $Day ?></td>
        <td align="left" valign="middle" bgcolor="#990000"><?php echo "Respect ", $respect ?></td>
    </tr>
  </table>

  <p><?php
  if ($money > 1000) {
  echo "you have suceed";
  }
  else {
  echo "Welcome to php test";
  }
 
  ?>
</p>
  <p>Here are the result <?php
  if ($any > 1) {
  $moeny = ($money - $caliorg_price);
  echo "£ ", $money;
  $day ++;
  }
  ?> </p>

The line that is colour blue does not get updated it still says 200, i want it to calculate and have the remaining subtraction of 275 so $money should be 275 instead of staying on 200

Thank you
« Last Edit: July 13, 2006, 02:51:48 PM by T-Chai »

Rob Pomeroy



    Prodigy

  • Systems Architect
  • Thanked: 124
    • Me
  • Experience: Expert
  • OS: Other
Re: php help
« Reply #1 on: July 14, 2006, 03:34:35 AM »
Your problem is a typo.  This line:
$moeny = ($money - $caliorg_price);
- you've spelt "money" wrong.  Try:
$money = ($money - $caliorg_price);
;)

PS  A tip: you can cut down on variable name typos by using a decent PHP editor like TSWebEditor - it can auto-complete variable names that you've already typed.  :)
« Last Edit: July 14, 2006, 03:37:16 AM by robpomeroy »
Only able to visit the forums sporadically, sorry.

Geek & Dummy - honest news, reviews and howtos

T-Chai

  • Guest
Re: php help
« Reply #2 on: July 14, 2006, 09:19:41 AM »
My bad  :-?

T-Chai

  • Guest
Re: php help
« Reply #3 on: July 14, 2006, 09:44:03 AM »
I have a Menu with these list:
 
<select name="select">
      <option value="caliorg">Californai Orange</option>
      <option value="northen">Northen Lights</option>
      <option value="phaze">Perple Haze</option>
      <option value="shiva">Shiva</option>
      <option value="super">Super Skunk</option>
      <option value="white">White Widow</option>
      <option value="thai">Thai Weed</option>
    </select>
 
Are these is save as variable and can be use in php?
Can i creat arrays with those value so:
 
                    Singles   |    Strings    |   Strings    
   caliorg    |   £22.50   | California Orange |  For bla bla    
  northen   |  £22.87    | Northen lights | Blabalbla
   phaze     |  £24.33    | Purple Haze  | bla bla bla
 
And how do i use the variable names?
« Last Edit: July 15, 2006, 05:15:56 AM by T-Chai »