![]() |
| |||||||
| Home | Forums | Rules | All Albums | Blogs | Donate | Subscriptions | Register | Mark Forums Read |
| Internet/Networking Everything concerning your internet connection or network, as well as browsers. |
![]() |
| | LinkBack | Thread Tools |
| | #1 |
| Lvl 1 College Student | 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? |
| |
| | #2 |
| I'm Evil | 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 |
| |
| | #3 |
| Banned Join Date: Jun 2006 Location: /home/yurimxpxman
Posts: 1,695
| 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>
Code: <html> <head> <title> Calc </title> </head> <body> <?php print 'Total price: '.POST["amount"]*POST["price"]; </body> </html> |
| |
| | #4 |
| Lvl 1 College Student | 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 |
| |
| | #5 |
| Banned Join Date: Jun 2006 Location: /home/yurimxpxman
Posts: 1,695
| 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>
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>
|
| |
| | #6 |
| Lvl 1 College Student | 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 =) |
| |
| | #7 | |
| Banned Join Date: Jun 2006 Location: /home/yurimxpxman
Posts: 1,695
| Quote:
| |
| |
| | #9 |
| Banned Join Date: Jun 2006 Location: /home/yurimxpxman
Posts: 1,695
| PC__MAX lol. He's from the MPC forums. We'll have to invite him to HL. He's awesome :) |
| |
| | #10 |
| Lvl 1 College Student | 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. |
| |
![]() |
|
| Tags |
| php, script |
| Thread Tools | |
|
|
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 |