HardwareLogic

Go Back   HardwareLogic > Specific Hardware > Internet/Networking
Home Forums Rules All AlbumsBlogs Donate Subscriptions Register Mark Forums Read

Internet/Networking Everything concerning your internet connection or network, as well as browsers.

Closed Thread
 
LinkBack Thread Tools
Old November 11th, 2006   #1
Lvl 1 College Student
 
Zambini's Avatar
 
Join Date: Oct 2006
Location: St. Mere du SantaCruz
Posts: 1,917
Blog Entries: 1
Default PHP script

I want to make a simple php page where I can calculate stuff for Eve-Online.

Pretty much this spreadsheet but in a PHP script.

I was thinking of using it like This

Can anyone explain to me how to do this?





Zambini is offline  
Old November 11th, 2006   #2
I'm Evil
 
Capper's Avatar
 
Join Date: Dec 2005
Location: Las Vegas, NV
Posts: 5,609
Blog Entries: 6
Default

I'm fairly inexperienced when it comes to PHP and scripts....Josh (Yuri) might be a good place to start, and you might hit up Neo-Angelo and MantaBase...they might have some ideas



INTEL QX9650
ASUS P5E3 Premium
4GB DDR3-1600
Sapphire HD 3870X2
Danger Den Tower-26 (Custom W/C)
5 x Seagate 250GB HDD in RAID5
BFG ES 800W PSU
Capper is online now  
Old November 11th, 2006   #3
Banned
 
yurimxpxman's Avatar
 
Join Date: Jun 2006
Location: /home/yurimxpxman
Posts: 1,695
Default

Basically what you're looking at is a simple bit of math. It'll look something like this:

index.html
Code:
<html>
 <head>
  <title>
   Calc
  </title>
 </head>
 <body>
  <form action="calc.php" method="POST">
   <input type="text" name="amount" value="Amount of Ore" onFocus="if (value=='Amount of Ore') { value=''; style.color='#000000' }" onBlur="if (value=='') {value='Amount of Ore'; style.color='#888888'; }" style="color:#88888">
   <input type="text" name="price" value="Price per Ore" onFocus="if (value=='Price per Ore') { value=''; style.color='#000000' }" onBlur="if (value=='') {value=Price per Ore'; style.color='#888888'; }" style="color:#88888">
   <input type="submit" value="Calculate">
  </form>
 </body>
</html>
calc.php
Code:
<html>
 <head>
  <title>
   Calc
  </title>
 </head>
 <body>
  <?php
   print 'Total price: '.POST["amount"]*POST["price"];
 </body>
</html>
yurimxpxman is offline  
Old November 11th, 2006   #4
Lvl 1 College Student
 
Zambini's Avatar
 
Join Date: Oct 2006
Location: St. Mere du SantaCruz
Posts: 1,917
Blog Entries: 1
Default

I do that but then it returns with this.

And I want them to be on the same page as well, can I do that somehow?



Parse error
: syntax error, unexpected '[' in /home/zambinid/public_html/files/eveonline/calc.php on line 9





Zambini is offline  
Old November 11th, 2006   #5
Banned
 
yurimxpxman's Avatar
 
Join Date: Jun 2006
Location: /home/yurimxpxman
Posts: 1,695
Default

Yeah, I made a couple mistakes when I first wrote it (I forget the $_ before the POST variables and I forgot to end the php tag.. my bad). Here's a one page version of it, though I'd recommend using JavaScript for something this simple.

index.php
Code:
<html>
 <head>
  <title>
   Calc
  </title>
 </head>
 <body>
  <form action="index.php" method="POST">
   <input type="text" name="amount" value="Amount of Ore" onFocus="if (value=='Amount of Ore') { value=''; style.color='#000000' }" onBlur="if (value=='') {value='Amount of Ore'; style.color='#888888'; }" style="color:#88888">
   <input type="text" name="price" value="Price per Ore" onFocus="if (value=='Price per Ore') { value=''; style.color='#000000' }" onBlur="if (value=='') {value='Price per Ore'; style.color='#888888'; }" style="color:#88888">
   <input type="submit" value="Calculate">
  </form>
  <?php
   if (isset($_POST["amount"]) && isset($_POST["price"]))
   {
    print 'Total price: '.($_POST["amount"] * $_POST["price"]);
   }
  ?>
 </body>
</html>
Here's the JavaScript version:

index.html
Code:
<html>
 <head>
  <title>
   Calc
  </title>
 </head>
 <body>
  <input type="text" id="amount" value="Amount of Ore" onFocus="if (value=='Amount of Ore') { value=''; style.color='#000000' }" onBlur="if (value=='') {value='Amount of Ore'; style.color='#888888'; }" style="color:#88888">
  <input type="text" id="price" value="Price per Ore" onFocus="if (value=='Price per Ore') { value=''; style.color='#000000' }" onBlur="if (value=='') {value='Price per Ore'; style.color='#888888'; }" style="color:#88888">
  <input type="button" value="Calculate" onClick="document.getElementById('div_out').innerHTML='Total price: $'+document.getElementById('amount').value*document.getElementById('price').value">
  <div id="div_out"></div>
 </body>
</html>
yurimxpxman is offline  
Old November 11th, 2006   #6
Lvl 1 College Student
 
Zambini's Avatar
 
Join Date: Oct 2006
Location: St. Mere du SantaCruz
Posts: 1,917
Blog Entries: 1
Default

hmm.. it works, but it seems too complicated to do effectively, is there a way I can make it into an interactive XML?
Here is what it can be saved as an XML, but it doesnt offer any interactivity, and neither does the html file. I can enable "interactivity" but it only saves it as this crappy page and thats just lame. Is there a way to use the XML as an interactive page?


Thanks for your help, though =)





Zambini is offline  
Old November 11th, 2006   #7
Banned
 
yurimxpxman's Avatar
 
Join Date: Jun 2006
Location: /home/yurimxpxman
Posts: 1,695
Default

Quote:
Originally Posted by Zambini View Post
hmm.. it works, but it seems too complicated to do effectively, is there a way I can make it into an interactive XML?
Here is what it can be saved as an XML, but it doesnt offer any interactivity, and neither does the html file. I can enable "interactivity" but it only saves it as this crappy page and thats just lame. Is there a way to use the XML as an interactive page?


Thanks for your help, though =)
There is, though I've never spent much time with XML. PC__MAX knows how to do XML rather well. You should shoot him a PM.
yurimxpxman is offline  
Old November 11th, 2006   #8
Lvl 1 College Student
 
Zambini's Avatar
 
Join Date: Oct 2006
Location: St. Mere du SantaCruz
Posts: 1,917
Blog Entries: 1
Default

ok, Ill pm him aboot this :)
thanks

[edit] errrm... whats his username?





Zambini is offline  
Old November 11th, 2006   #9
Banned
 
yurimxpxman's Avatar
 
Join Date: Jun 2006
Location: /home/yurimxpxman
Posts: 1,695
Default

PC__MAX lol. He's from the MPC forums. We'll have to invite him to HL. He's awesome :)
yurimxpxman is offline  
Old November 11th, 2006   #10
Lvl 1 College Student
 
Zambini's Avatar
 
Join Date: Oct 2006
Location: St. Mere du SantaCruz
Posts: 1,917
Blog Entries: 1
Default

that would explain why he didnt appear on these forums :)
I'll pm him a linky and hopefully he will join the logical side......
(lol)


His MPC name is PCMAX, right?






Last edited by Zambini; November 11th, 2006 at 22:49.
Zambini is offline  
Closed Thread

  HardwareLogic > Specific Hardware > Internet/Networking

Tags
php, script


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
DHCP profile, locating and identi file or script? Tech Geek Deluxe Troubleshooting 3 November 13th, 2007 14:21
differential backups script for Unix yurimxpxman Software & OSs 0 May 16th, 2007 20:37
Gaim currently listening script for Amarok yurimxpxman Software & OSs 8 February 26th, 2007 15:31


All times are GMT -8. The time now is 10:50.


Powered by vBulletin® Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
© HardwareLogic 2005 - 2008. All Rights Reserved


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49