Jump to content

otuatail

Members
  • Posts

    961
  • Joined

  • Last visited

Everything posted by otuatail

  1. Sorry never done this before is this right? Line 38 is the text box Lines 77-79 use the post I can't see any duplication of name of text boxes Page = http://www.des-otoole.co.uk/utility2/utility_compare.php code = [code]<? $stamp = time(); $val = date("d-m-Y H:i:s",$stamp); //echo($val); print_r($_POST); // echo $randval = rand(); ?> <html> <title>Utility</title> <body> <form action="utility_compare.php" method="post"> <table border="0"> <tr><td colspan="2" align="center" height="50"><b><u>UN-Capped</u></b> <td width="30"></td> <td colspan="2" align="center" height="50"><b><u>Capped</u></b></tr><td width="30"></td> <tr><td colspan="5" align="center"><b>Electric Reading</b></tr> <tr> <td>High p </td><td><input type="text" name="E_U_High" value="12.702" size="4"></td><td></td> <td>High p </td><td><input type="text" name="E_C_High" value="12.970" size="4"></td><td></td> <td>Units </td><td><input type="text" name="E_Units" value="4844" size="4"></td> </tr> <tr> <td>Low p </td><td><input type="text" name="E_U_Low" value="7.292" size="4"></td><td></td> <td>Low p </td><td><input type="text" name="E_C_Low" value="5.560" size="4"></td> </tr> <tr><td colspan="6"><hr></tr> <tr><td colspan="6" align="center"><b>Gas Reading</b></tr> <tr> <td>High p </td><td><input type="text" name="G_U_High" value="3.422" size="4"></td><td></td> <td>High p </td><td><input type="text" name="G_C_High" value="2.912" size="4"></td><td></td> <td>Units </td><td><input type="text" name="G_Units" value="480" size="4"></td> </tr> <tr> <td>Low p </td><td><input type="text" name="G_U_Low" value="2.417" size="4"></td><td></td> <td>Low p </td><td><input type="text" name="G_C_Low" value="1.619" size="4"></td><td></td> <td>Kwh </td><td><input type="text" name="G_Kwh" value="11.52" size="4"></td> </tr> <tr><td colspan="6"><hr></tr> <tr><td colspan="5" align="center"><input type="submit" value="Calculate" Name="submit" </td></tr> </table> <? // Electric Uncapped ******* if($_POST['E_Units'] > 900)     {     $E_High_Units = 900;     $E_Low_Units = $_POST['E_Units'] - 900;     } else     {     $E_High_Units = $_POST['E_Units'];     $E_Low_Units = 0;     } if($_POST['G_Units'] > 100)     {     $G_High_Units = 100;     $G_Low_Units = $_POST['G_Units'] - 100;     } else     {     $G_High_Units = $_POST['G_Units'];     $G_Low_Units = 0;     } // Electric Uncapped ******* $E_U_High_val = $_POST['E_U_High'] * $E_High_Units / 100; $E_U_Low_val = $_POST['E_U_Low'] * $E_Low_Units / 100; // Electric Capped ******** $E_C_High_val = $_POST['E_C_High'] * $E_High_Units / 100; $E_C_Low_val = $_POST['E_C_Low'] * $E_Low_Units / 100; //    GAS Uncapped ******* $_KWH = $_POST['G_Kwh']; $_KWH = '11.52'; //Use this instead echo '$_KWH = ' . $_KWH; $G_U_High_val = $_POST['G_U_High'] * $G_High_Units / 100 * $_KWH; $G_U_Low_val = $_POST['G_U_Low'] * $G_Low_Units / 100 * $_KWH; //    GAS Capped ******* $G_C_High_val = $_POST['G_C_High'] * $G_High_Units / 100 * $_KWH; $G_C_Low_val = $_POST['G_C_Low'] * $G_Low_Units / 100 * $_KWH; $Uncap_total = $E_U_High_val + $E_U_Low_val + $G_U_High_val + $G_U_Low_val; $Cap_total = $E_C_High_val + $E_C_Low_val + $G_C_High_val + $G_C_Low_val; if($Cap_total > 0)     $Percent = ($Uncap_total - $Cap_total) / $Cap_total * 100; else     $Percent = 0; ?> <table border="0"> <tr><td><?=$E_High_Units?> * <?=$_POST['E_U_High']?> = </td><td>£<?=money_format("%4.2n",$E_U_High_val)?></td></tr> <tr><td><?=$E_Low_Units?> * <?=$_POST['E_U_Low']?> = </td><td>£<?=money_format("%3.2n", $E_U_Low_val)?></td></tr> <tr><td width="80">Total</td><td>£<?=money_format("%3.2n", ($E_U_High_val + $E_U_Low_val))?></td></tr> <tr><td colspan="2"><hr></td></tr> <tr><td><?=$G_High_Units?> * <?=$_POST['G_U_High']?> = </td><td>£<?=money_format("%3.2n", $G_U_High_val)?></td></tr> <tr><td><?=$G_Low_Units?> * <?=money_format("%3.3n", $_POST['G_U_Low'])?> = </td> <td width="80">£<?=money_format("%3.2n", $G_U_Low_val)?></td></tr> <tr><td>Total </td><td>£<?=money_format("%3.2n", $G_U_High_val + $G_U_Low_val)?></td> <td>£<?=money_format("%3.2n", ($Uncap_total))?></td> <td><b>UN-Capped</b><td></tr> <tr><td colspan="3" height="30"><hr></td></tr> <tr><td><?=$E_High_Units?> * <?=$_POST['E_C_High']?> = </td><td>£<?=$E_C_High_val?></td></tr> <tr><td><?=$E_Low_Units?> * <?=money_format("%10.2n", $_POST['E_C_Low'])?> = </td> <td>£<?=money_format("%3.2n", $E_C_Low_val)?></td></tr> <tr><td>Total</td><td>£<?=money_format("%3.2n", $E_C_High_val + $E_C_Low_val)?></td></tr> <tr><td colspan="2"><hr></td></tr> <tr><td><?=$G_High_Units?> * <?=$_POST['G_C_High']?> = </td><td>£<?=money_format("%3.2n", $G_C_High_val)?></td></tr> <tr><td><?=$G_Low_Units?> * <?=$_POST['G_C_Low']?> = </td><td>£<?=money_format("%3.2n", $G_C_Low_val)?></td></tr> <tr><td>Total </td><td>£<?=money_format("%3.2n", ($G_C_High_val + $G_C_Low_val))?></td> <td>£<?=money_format("%3.2n", $Cap_total)?></td> <td><b>Capped</b><td></tr> <tr><td>£<?=money_format("%3.2n",($Uncap_total - $Cap_total))?></td><td><?=money_format("%3.2n",$Percent)?>%</td></tr> </table> </form> </body> </html>[/code]
  2. Line 38 is the text boxx Lines 77-79 use the post Page = http://www.des-otoole.co.uk/utility2/utility_compare.php code = # <? $stamp = time(); $val = date("d-m-Y H:i:s",$stamp); //echo($val); print_r($_POST); // echo $randval = rand(); ?> <html> <title>Utility</title> <body> <form action="utility_compare.php" method="post"> <table border="0"> <tr><td colspan="2" align="center" height="50"><b><u>UN-Capped</u></b> <td width="30"></td> <td colspan="2" align="center" height="50"><b><u>Capped</u></b></tr><td width="30"></td> <tr><td colspan="5" align="center"><b>Electric Reading</b></tr> <tr> <td>High p </td><td><input type="text" name="E_U_High" value="12.702" size="4"></td><td></td> <td>High p </td><td><input type="text" name="E_C_High" value="12.970" size="4"></td><td></td> <td>Units </td><td><input type="text" name="E_Units" value="4844" size="4"></td> </tr> <tr> <td>Low p </td><td><input type="text" name="E_U_Low" value="7.292" size="4"></td><td></td> <td>Low p </td><td><input type="text" name="E_C_Low" value="5.560" size="4"></td> </tr> <tr><td colspan="6"><hr></tr> <tr><td colspan="6" align="center"><b>Gas Reading</b></tr> <tr> <td>High p </td><td><input type="text" name="G_U_High" value="3.422" size="4"></td><td></td> <td>High p </td><td><input type="text" name="G_C_High" value="2.912" size="4"></td><td></td> <td>Units </td><td><input type="text" name="G_Units" value="480" size="4"></td> </tr> <tr> <td>Low p </td><td><input type="text" name="G_U_Low" value="2.417" size="4"></td><td></td> <td>Low p </td><td><input type="text" name="G_C_Low" value="1.619" size="4"></td><td></td> <td>Kwh </td><td><input type="text" name="G_Kwh" value="11.52" size="4"></td> </tr> <tr><td colspan="6"><hr></tr> <tr><td colspan="5" align="center"><input type="submit" value="Calculate" Name="submit" </td></tr> </table> <? // Electric Uncapped ******* if($_POST['E_Units'] > 900)     {     $E_High_Units = 900;     $E_Low_Units = $_POST['E_Units'] - 900;     } else     {     $E_High_Units = $_POST['E_Units'];     $E_Low_Units = 0;     } if($_POST['G_Units'] > 100)     {     $G_High_Units = 100;     $G_Low_Units = $_POST['G_Units'] - 100;     } else     {     $G_High_Units = $_POST['G_Units'];     $G_Low_Units = 0;     } // Electric Uncapped ******* $E_U_High_val = $_POST['E_U_High'] * $E_High_Units / 100; $E_U_Low_val = $_POST['E_U_Low'] * $E_Low_Units / 100; // Electric Capped ******** $E_C_High_val = $_POST['E_C_High'] * $E_High_Units / 100; $E_C_Low_val = $_POST['E_C_Low'] * $E_Low_Units / 100; //    GAS Uncapped ******* $_KWH = $_POST['G_Kwh']; $_KWH = '11.52'; //Use this instead echo '$_KWH = ' . $_KWH; $G_U_High_val = $_POST['G_U_High'] * $G_High_Units / 100 * $_KWH; $G_U_Low_val = $_POST['G_U_Low'] * $G_Low_Units / 100 * $_KWH; //    GAS Capped ******* $G_C_High_val = $_POST['G_C_High'] * $G_High_Units / 100 * $_KWH; $G_C_Low_val = $_POST['G_C_Low'] * $G_Low_Units / 100 * $_KWH; $Uncap_total = $E_U_High_val + $E_U_Low_val + $G_U_High_val + $G_U_Low_val; $Cap_total = $E_C_High_val + $E_C_Low_val + $G_C_High_val + $G_C_Low_val; if($Cap_total > 0)     $Percent = ($Uncap_total - $Cap_total) / $Cap_total * 100; else     $Percent = 0; ?> <table border="0"> <tr><td><?=$E_High_Units?> * <?=$_POST['E_U_High']?> = </td><td>£<?=money_format("%4.2n",$E_U_High_val)?></td></tr> <tr><td><?=$E_Low_Units?> * <?=$_POST['E_U_Low']?> = </td><td>£<?=money_format("%3.2n", $E_U_Low_val)?></td></tr> <tr><td width="80">Total</td><td>£<?=money_format("%3.2n", ($E_U_High_val + $E_U_Low_val))?></td></tr> <tr><td colspan="2"><hr></td></tr> <tr><td><?=$G_High_Units?> * <?=$_POST['G_U_High']?> = </td><td>£<?=money_format("%3.2n", $G_U_High_val)?></td></tr> <tr><td><?=$G_Low_Units?> * <?=money_format("%3.3n", $_POST['G_U_Low'])?> = </td> <td width="80">£<?=money_format("%3.2n", $G_U_Low_val)?></td></tr> <tr><td>Total </td><td>£<?=money_format("%3.2n", $G_U_High_val + $G_U_Low_val)?></td> <td>£<?=money_format("%3.2n", ($Uncap_total))?></td> <td><b>UN-Capped</b><td></tr> <tr><td colspan="3" height="30"><hr></td></tr> <tr><td><?=$E_High_Units?> * <?=$_POST['E_C_High']?> = </td><td>£<?=$E_C_High_val?></td></tr> <tr><td><?=$E_Low_Units?> * <?=money_format("%10.2n", $_POST['E_C_Low'])?> = </td> <td>£<?=money_format("%3.2n", $E_C_Low_val)?></td></tr> <tr><td>Total</td><td>£<?=money_format("%3.2n", $E_C_High_val + $E_C_Low_val)?></td></tr> <tr><td colspan="2"><hr></td></tr> <tr><td><?=$G_High_Units?> * <?=$_POST['G_C_High']?> = </td><td>£<?=money_format("%3.2n", $G_C_High_val)?></td></tr> <tr><td><?=$G_Low_Units?> * <?=$_POST['G_C_Low']?> = </td><td>£<?=money_format("%3.2n", $G_C_Low_val)?></td></tr> <tr><td>Total </td><td>£<?=money_format("%3.2n", ($G_C_High_val + $G_C_Low_val))?></td> <td>£<?=money_format("%3.2n", $Cap_total)?></td> <td><b>Capped</b><td></tr> <tr><td>£<?=money_format("%3.2n",($Uncap_total - $Cap_total))?></td><td><?=money_format("%3.2n",$Percent)?>%</td></tr> </table> </form> </body> </html> #
  3. Thanks I have tried print_r($_POST); the last texbox is missing and I have at the end [submit] => Calculate ) If I do Post the php page, how. Last time I tried this it came out on the group as a html page or something. Desmond.
  4. I would have a login table and supply a unique UserID number, but the amount of code here is too large. Just the sections that are relivent would do. Desmond.
  5. Can someone tell me if there is a limit to $_POST. I have 12 text boxes on a form but i can't retreve the last one. There is no spellinf mistake or case sensitive problems. i have renamed the text box several times but nothing. Desmond.
  6. Thanks. Getting a bit late in the day.  Desmond.
  7. I am getting a  'Call to undefined function: msql_num_rows()' I want to trap an error where there are no records $sql = "SELECT * FROM Accounts WHERE USR = '" . $USR . "' AND PWD = '" . $PWD . "'"; $qAccess = mysql_query($sql) or die(mysql_error()); echo msql_num_rows($qAccess); I have searched the documentation but not found any examples. Desmond.
  8. Hi. The time function does not take any argument  = int time ( void ) I need to get a stamp value for specific dates and tomes like $stamp1 = time(); $stamp2 = time("1-1-2000"); Is there a function that can achive this please. Desmond.
  9. Not if he sets a session variable
  10. Frames are a bad idea. If you repeatedly call the same home page. use a variable or session variable on the index.php page have the following if(page == 1) { include(page1.phpl'); }
  11. Can anyone help on Unix/Lynux The server I am using for the website is Unix/Lynux. I have a text based file like notepad I am trying to apend lines to it but I do not get a new line each time instead i get a symbol of a square and it carries on. The code is $fh = fopen("hitlog.txt","a"); fwrite($fh,$val . "\r\n"); fclose($fh); The \r\n don't seem to have an efect. Any Ideas Desmond.
  12. If the field name is firstname then it should be $sql="INSERT INTO buttons (firstname ) VALUES ($_POST[firstname])"; Des.
  13. Can someone tell me which is the correct usage of $_SESSION I have seen it and used it witha nand without single quoates. $_SESSION[Data] and $_SESSION['Data'] both of these work and seem to be interchangable. I s there a potential problem with this. Desmond.
  14. Hi. I have been trying to get away from using frameset and those on this group agree. The problem is preventing content on the left of a table affecting the content of data on the right of a table. I am taking over from someone else’s code here. Is there a fool proof way that I can get through this without splitting content on the right side into separate rows in order to force the left side. www.droneuk.co.uk/dying_for_you-2.php With framesets this was not a problem. Paul
  15. On a previous post I was concerned with robots seeing code. Now I know they can’t I would like to create a page that would satisfy the robot with the contents of the website (knowing in advance it is a robot) instead of a user friendly page. If I create a html page on the server, how can I include it in my main page. Something like index.php <? if (IsRobot() ) Insert  Dumy_page.html else ?> <html> ... Original html here </html> Thanks Desmond.
  16. A=65  a=97 therefore Z > A but a > Z need to capitalise the data
  17. How can you do a > on text YO30 Rbd is greater than AB10 6QW  2 totaly difrent parts of the country? Des.
  18. But a statment made said if they see a re-direction they will refuse because they think they are being conned. If they can't see php they can't see the re-direction. If i wanted to force there hand i could (Knowing they are robots) deliver a difrent page to them and they wouldent know. (A page with cmore compresed information for them to see.)
  19. You could sort by rating. Maybe have 5 images for effect But the next line needs changing. from $sql="SELECT * FROM tabHotel WHERE regionId = $id"; to $sql="SELECT * FROM tabHotel WHERE regionId = " . $id;
  20. Try echo date('D d-M-Y'); look up date function Desmond.
  21. I wanted to get my website indexed by robots, but having seen some articles on the website this looks unlikely. According to some information some engines do not look at meta tags only the content. They avoid sites that have re-directions and cannot handle sites with a database backend as they cant access the data. This looks like they can see the WebPages at source on the server, not as pure html. They prefer to see the information at the top of the page. I have php at the top of mine. I have a session variable so I can create a hit counter, a simple redirection to under-construction so I can do development. A called function, to see if it is a robot and avoid a hit count. On top off all this I collect data to see which page has been visited. It appears that all this PHP is getting in the way. If I want my site indexed I have to strip out all code. I have been asked to do a business site but don’t think I can get it on a search engine. Is there any way around this, or do I do strait html. Paul.
  22. Sorted it out. Simple realy. Why I did not think of it sooner. Use a session variable for the "name" session_start(); $stamp = time(); if($_SESSION['Entry'] == "")     $_SESSION['Entry'] = $stamp; AND <input type="text" name="<?=$_SESSION['Entry']?>"> Desmond.
  23. I don't know if this is possible but I have a web page that displays content from a MySQL database. I have a box that if filled in can narow down the search. I thought it wouls be a good idea to add another box so I could write a complete SQL statment. The problem is the text box is behaving like a browser entry box. as soon as I type SELECT I get an enormous history of all SELECT statments. Can this be prevented as it is very disconcerting. Desmond.
  24. This may be impossible. I am trying to send a text message through a company i have registered with. The problem is, I can create the URL complete with user name and password. I can then user the function header(location:) this however opens up a new page and sends the text message. exposing my username and password. I need this to be transparent. If i have an include file, i can call a function sendsms("My Message"); The function has all the other details including the URL. Can I execute this in someway without opening a new webpage and displaying everything. Desmond.
  25. Don't worry It's easy I just use the following $domain = $_SERVER['HTTP_HOST'];
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.