Jump to content

dan_t

Members
  • Posts

    137
  • Joined

  • Last visited

Everything posted by dan_t

  1. No, sorry never heard of it. I wish I did but I'm not real good with PHP yet. I do not if I ever wiil be, doesn't feel like it. :'(
  2. <?php echo hex_to_decimal('0xff'); echo "<br>\n"; echo hex_to_decimal('1e5a'); define("INVALID_HEX_STRING", "Invalid hex string", true); function hex_to_decimal ($hex) { $hex = strtolower($hex); $hex = trim($hex); if (substr($hex, 0, 2) == '0x') $hex = substr($hex, 2); $result = 0; while ($hex != ' ') { $char = substr($hex, 0, 1); if (ord($char) >= ord('a') and ord($char) <= ord('f')) $val = 10 + (ord($char) - ord('a')); else if (ord($char) >= ord('0') and ord($char) <= ord('9')) $val = ord($char) - ord('0'); else return INVALID_HEX_STRING; $result = ($result * 16) + $val; $hex = substr($hex, 1); } return $result; } ?> I may have done this wrong, but this did not work either. Is it possible something is not set in the "ini" file?
  3. I was wondering if someone could tell me why this won't work. <?php echo hex_to_decimal('0xff'); echo "<br>\n"; echo hex_to_decimal('1e5a'); function hex_to_decimal ($hex) { $hex = strtolower($hex); $hex = trim($hex); if (substr($hex, 0, 2) == '0x') $hex = substr($hex, 2); $result = 0; while ($hex != ' ') { $char = substr($hex, 0, 1); if (ord($char) >= ord('a') and ord($char) <= ord('f')) $val = 10 + (ord($char) - ord('a')); else if (ord($char) >= ord('0') and ord($char) <= ord('9')) $val = ord($char) - ord('0'); else return INVALID_HEX_STRING; $result = ($result * 16) + $val; $hex = substr($hex, 1); } return $result; } ?> It just errors about a problem with the invalid_hex_string constant.
  4. No help on this one, but in case someone reads it I figured out what was wrong. I somehow saved it under something different, when I switched it back to UTF-8 it worked fine. No one has ever mentioned it as far as what I have read, but CodeLobster really is pretty nice. They have a PHP Edition, and it is free. You should try it sometime and see how you like it. Thanks Dan
  5. I have been using codelobster a lot and it was working fine, then while saving a file in a hurry I may have save the wrong way. After that the scripts would not show up. I can write the same script and save with dreamweaver and it shows up fine. Any ideas on what the problem could be?
  6. dan_t

    PHP5

    it's "test.php"
  7. dan_t

    PHP5

    When I was loading the php, it asked for a domain name and a name for my computer. I don't know if that helped your question. It should have given me all the information on my system script stuff, but it only had shown me what I typed in, including the php tags. So I guess for some reasonit didn't run through the parser?
  8. dan_t

    PHP5

    Hello Everyone, Quick question. I have installed MySql, Apache 2.2, and PHP5. When I ran "phpinfo()" on the browser it just showed the html, not the info. I have a feeling the problem may be when I entered what I thought was the correct way for domain, since I do not have a web site, I entered myhomedomain.com. Should I have entered localhost or what? Or is the problem somewhere else completely? Thanks Dan
  9. dan_t

    ul lists

    Can anyone tell me why my list, running horizontally stairsteps downward in IE. It looks fine in all the other browsers. Thanks Dan
  10. dan_t

    IE problem

    Hi everyone, I have a little problem here. The CSS I'm using worked with every browser but Internet Explorer. For some reason my navbar goes to the middle of the screen. But on all the other browsers it is on the left, where it shoud be. How can I fix this? Here is my CSS, you will see I have tried a hundred different ways. @charset "utf-8"; /* CSS Document */ body { width:98%; height:100%; font-size:small; padding:0; margin:0; text-align:center; color: #FF3333; } #container { font:Verdana, Arial, Helvetica, sans-serif; text-align:center; margin:auto; height:100%; } h1 {font-family:Arial, Helvetica, sans-serif; font-weight:bold; font-size:60pt; color:#FFFFFF; } h2 { font-family:Arial, Helvetica, sans-serif; font-size:12pt; font-weight:normal; color:#FFFFFF; } .smprint { font-family:Arial, Helvetica, sans-serif; font-size:12pt; font-weight:normal; color:#FFFFFF; } #nav { left:auto; margin-left:10%; margin-right:65%; } #rightCol { float:left; margin-right:20%; text-decoration: none; color: #FF3300; width: 25%; height: auto; clear: none; } #contacts { background-color:#FFFFFF; margin-right:35%; float:right; padding-right:15px; padding-left:15px; } #rightalign { color:#FF3333; margin-right:20%; text-align:center; word-spacing:normal; float:none; margin-left:50%; width: auto; }
  11. Hi, You know the WAMP homepage that has the phpmyadmin, and MySql, and the projects folder? I keep losing it. I don't know what I could be doing to keep changing the path, but how do I get back to it?
  12. OK, after literally hours of trying last night, I reinstalled just now and it worked. I do not know why, but that's great. Thanks
  13. Hello everyone, I had a huge problem with IIS taking over my computer. After a full weeks work I found all the files (scattered all over) and got it all removed. I have reinstalled my wamp server probably a dozen times, taking everything off, even deleting the www folder. Everytime I reinstall it and save a file, I open the wampserver page and there are no files showing up in "My Projects" on the page saved as .html or .php. When you do a save as, it shows them in the www folder. So where are they?? Can anyone help? Please. Thanks Dan
  14. dan_t

    old code

    I just thought I would add, If you run the code you'll see it takes the type of bean, and amount. It just will not enter and calculate a price. I'll be a lot happier when I finally understand.
  15. dan_t

    old code

    OK I tried running it with the ifelse statement in the middle and got this: Notice: Undefined variable: price in C:\wamp\www\tests\do_calculate.php on line 13 Notice: Undefined variable: price in C:\wamp\www\tests\do_calculate.php on line 17 You ordered 1 bags of Ethiopian Harrar. Bags of Ethiopian Harrar are $0.00 each. Your subtotal is $0.00. Sales tax is 8.25% in this location. $0.00 has been added to your order. You owe $0.00 for your coffee. I can't seem to define the $price variable within the statement. But I don't want to deviate from the book, that would take away the shortcut. Being assigning the amount inside the ifelse. ie.. $price = 14.65. I was able to define quantity because of the "name" in the form, but the $price in within the $bean variable. <form method="post" action="do_calculate.php"> <p>Select a bean type:</p> <select name="beans" size"1"> <option value="Ethiopian Harrar">Ethiopian Harrar - $14.95</option> <option value="Kona">Kona - $16.25</option> <option value="Sumatra">Sumatra - $13.00</option> </select> <p>How many bags would you like?</p> <select name="quantity" size="1"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <select> <input type="submit" value="Submit"> </form>
  16. dan_t

    old code

    It says to use that but it doesn't work. It's not posting anything for the price. It says its undefined. It was that or HTTP_GET_VARS. Those are the only things I did not copy from the book. Otherwise Shouldn't it work?
  17. dan_t

    old code

    I have an old book, I know it is very out dated but it 's the only one I have. The example says to use the <?php_track_vars?> which I think is no longer used Right? So how would I go about making this work nowadays. Here is the code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <html> <head> <title>Bean Counter Results</title> </head> <body> <?php $price = ($_POST['price']); $beans = ($_POST['beans']); $sales_tax = .0825; $quantity = ($_POST['quantity']); $sub_total = $price * $quantity; $sales_tax_amount = $sub_total * $sales_tax; $sales_tax_pct = $sales_tax * 100; $grand_total = $sub_total + $sales_tax_amount; $fmt_price = sprintf("%0.2f",$price); $fmt_sub_total = sprintf("%0.2f",$sub_total); $fmt_sales_tax_amount = sprintf("%0.2f",$sales_tax_amount); $fmt_grand_total = sprintf("%0.2f",$grand_total); echo "<p>You ordered $quantity bags of $beans.</p>"; echo "<p>Bags of $beans are \$$fmt_price each.</p>"; echo "<p>Your subtotal is \$$fmt_sub_total.</p>"; echo "<p>Sales tax is $sales_tax_pct% in this location.</p>"; echo "<p>\$$fmt_sales_tax_amount has been added to your order.</p>"; echo "<p>You owe \$$fmt_grand_total for your coffee.</p>"; if ($beans == "Ethiopian Harrar") { $price = 14.25; } else if ($beans == "Kona") { $price = 16.25; } else if ($beans == "Sumatra") { $price = 13.00; } ?> </body> </html> Thanks Dan
  18. Hey Thanks stephan! I tried it earlier and it did not work. You posted it, I tried it again and it worked. I guess I was doing something wrong. Anyway, Thanks a lot!! Dan
  19. Hello, My question for today is: Say I have a form and it takes a user input from a text box named 'name'. How do I take the input from 'name' and make it a variable named $name? So that I can use it in an if else statement or whatever.
  20. OK, Never mind I got it back online. I had to switch ports. I guess I will have to do the same with phpmyadmin also. it's getting the same error.
  21. Hello, I have had my wamp server for about a year now. BUT, I was installing some asp stuff and somehow it took over my localhost. Instead of being wamp it is IIS 7.0. Question: How do I get my PHP stuff back? Delete and reinstall? I hope there is an easier way.
  22. dan_t

    isset

    That worked. If I used it with a form, would that work? Or do you ever isset $_POST?
  23. dan_t

    isset

    Do you mean, remove the ['name'] part?
  24. dan_t

    isset

    Hi everyone, I've got another basic question. The "isset" means you have your variable defined right? When I use it, it seems to do the opposite of what I would expect it to do. Here's my example: <?php $name = "Danielson"; if (isset($_POST['$name'])) { echo ("<h2> Hi, my name is " .$name.".</h2> <br />"); } else { echo ("I'm confused!"); } ?> It echo's "I'm confused". But with "!isset" it echo's"Hi, my name is Danielson. Why? Shouldn't it be just the opposite?
  25. Thank you very much for your help. On your first answer, why wouldn't you get the form name (form.php or whatever) instead of the "submit" name? Thanks and thanks for the link, I have read quite a bit. It kind of puts some of the pieces together. We blew by alot of the stuff in that class so fast that I never really understood what or why we were doing certain things. I'm finally after a year starting to understand (a little). Dan
×
×
  • 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.