Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About charlie321

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. OK It does parse an html file on my localhost server. So what changed the ability to parse an html file? Linux, php, windows? Just curious to find out why I can do it on localhost (workbench-windows) and not on linux-mariadb. Thanks.
  2. No.. Actually I have been saying that from the beginning of this thread. If I tried to pass this from the html file to the php file it passed nothing or 0. That was on my mariadb server. If I passed it on my localhost workbench server it worked. When I changed the html file to a php file ie test.php it worked on both servers. Like I said I'd love to know why even though I did find a work around. The original html and php scripts for this is in the original thread above.
  3. OK I have no idea why but I changed the html file to a php file and echoed the form. It actually works now on both the localhost and server. time() just would not pass from my html localhost script. I would love to know why. It might have something to do with the fact that my localhost is workbench and the server is mariadb. Or the server could be a newer version of php. Really appreciate the help and suggestions.
  4. OK I think I understand. You threw me off by calling the semi-colon a colon. Unfortunately that did not solve the problem.
  5. You are talking about a semi-colon not colon? You are talking about the php script? What specific line are you talking about?
  6. Could you please explain further? I think you were mistaken. But if you are certain you are correct about the colon please explain in detail.
  7. colon??? What are you talking about?
  8. Hi... I have a little form and php script where I am trying to pass date() and get the seconds it takes to fill out the form. This works fine on localhost which is window based, but does not work on my server which is linux. On my linux server a 0 or blank is showing in the passed field. Any ideas on what might be wrong? I believe tjis is some sort of a minor coding error but my server shows no errors. Here is the script: <html> <form method="POST" action="test_time.php"> <input type="hidden" name="tm" value="<?php echo time() ?>" /> <input type="text" name="Name" size="15" placeholder="Enter Name">&nbsp;&nbsp; <input type="submit" value="Go" name="Submit"> </form> </html> <?php date_default_timezone_set("America/New_York"); $name = ucwords(strtolower($_POST['Name'])); $st = $_POST['tm']; $formFilledInSeconds = time() - $st; echo $name."<br>"; echo "start time: ".$st."<br>"; echo "time: ".time()."<br>"; echo "seconds: " .$formFilledInSeconds."<br>"; ?>
  9. Yes that was the problem with the script which I finally figured out just after my last post. And then I realized this would work better. $stax = tax_invoice($state,$subtotal,$credit,$shipping); Blood dribbling down my head from the wall punches. Take care.
  10. This is the code that is calling the function: tax_invoice($state,$subtotal,$credit,$shipping); I wrote an example that should show what is happening. It does the exact same thing: <?php $stax = 0; $subtotal = 100; $ship = 15; echo (($subtotal+$ship) * .07). " This is outside the function Correct answer.<p>"; function example($subtotal,$ship,$stax) { $stax == (($subtotal+$ship) * .07); echo $stax . " This is inside the function. Wrong answer.<p>"; return $stax; } example($subtotal,$ship,$stax); ##calling function. Nothing there. echo " This is calling the function. Gives a null which is wrong."; ?> There is something I'm not getting. I would appreciate someone who knows php functions show me what I am doing wrong in the little script that describes the problem. I'd really appreciate it!
  11. I have posted a modified function above already. Please reference that. Below is the code that woks fine as a non- function: if ($state == "FL") { $stax = ($subtotal-$credit+$shipping) * .07; } As I have said, this works but is redundant as it is presented several times throughout the code. Thus my wanting to make it a function.
  12. I had taken the FL if statement out to see if that was the problem. But did not work that way either. This works fine in code. Basically am trying to get the result as sales tax for the state of Florida using subtotal of invoice, credit, and shipping totals. Something within the function is preventing that from happening as it never gives anything but 0 for sales tax variable ($stax) As I said it works fine in code. I believe it is something to do with the variables not passing into or out of the function. I have worked with functions in other languages with no problems passing variables. Has to be something I am missing.
  13. I tried this which I thought might be what you were getting at but no success. More help please. function tax_invoice($subtotal,$credit,$shipping,$state) { if ($state == "FL") { $stax = ($subtotal-$credit+$shipping) * .07; return $stax; } }
  14. Trying to understand php functions. function tax_invoice() { if ($state == "FL") { $stax = ($subtotal-$credit+$shipping) * .07; } } #call function: tax_invoice(); I have tried different variations including in script, on own functions program, using return, adding variables, etc. Nothing seems to work unless I use it as a non-function in code. Please help.
  • 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.