Jump to content

sKunKbad

Members
  • Posts

    1,832
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by sKunKbad

  1. haku, you were right. Thank you for pointing that out.
  2. I'm trying to set up a basic HTML document for Spanish, and I want it to have perfectly valid code. Do I have to use HTML character codes for all of the accented characters, or is there a better way? This is what I have: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html lang="es" xml:lang="es" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" /> <meta name="language" content="es" /> <title>Espanol</title> </head> <body> <p>¿Hemos mencionado que tenemos buenos precios? Nuestro servicio de césped dos veces por semana comienza tan bajo como $ 55.00 al mes para la siega y recorte de bordes de base. Malezas de tracción, la fumigación de malezas, la fertilización y servicios de jardinería están también disponibles.</p> </body> </html> but the accented characters show up as question marks inside diamonds. I thought if I used utf-8 then it was supposed to be good, but I don't know. Please help a English speaking guy understand!
  3. Using OOP doesn't mean you can't do things procedurally. If there is a simple script like this one, you would just be complicating things by trying to make a class, creating an object, etc. If you want to learn OOP fast, you might take a look at one of the popular PHP frameworks, like CodeIgniter, and see how things are done there. CodeIgniter still allows for PHP4, so you might look at Kohana if you want something that is strictly PHP5. I'm not saying you have to use the framework, only that it shows a great example of common tasks done with OOP PHP.
  4. I've used HTML inside of die() before, and inline CSS is just HTML, so it will work. I'm seeing that you are trying to block by IP, and while that is fairly useless, I think it is in your best interest if you don't output anything with die(), at least when dealing with people you are trying to block. Why let them know what is going on? Also, it would be better to block by IP inside your .htaccess, and then the user will get a forbidden message, and you won't have to style it.
  5. If you changed the white to off white: fffef2 or something similar, I think it would be better. fffef2 is a slight tint of yellow/orange. perhaps you could go with something that is a slight tint of another color? It's worth a try, since that is the main complaint here.
  6. As a portfolio, I imagine all it would do is help out your competition.
  7. Dude, sure, he made a joke and you expected a real response, but this is a forum mostly filled with 12-yr-olds. And most important of all, it's free. If you want an answer that won't wast your time, pay for it. Exactly. Also, if you expect any real help, you might watch your insults.
  8. Is the source code showing anything? My first thought was that you might be serving a stylesheet using php, or some other content that is gzip compressed (which IE6 doesn't like)
  9. how about: include 'main/rand.php';
  10. If nobody else visited the site, I think you have bigger problems than some session data hanging out on your server.
  11. You have to provide a little more logic. Where does A come from? What determines when to run a recursive function? If you are going to do recursion, at what point will the recursion stop? The calculation you have provided doesn't show a need for a recursive function, and based on your description, it's hard to know what you are after.
  12. There's nothing wrong with the template parser class. If you were to carefully read the docs, http://codeigniter.com/user_guide/libraries/parser.html , then you would see your mistakes. While you DO have mistakes in your controller and view code that would prevent it from working as a normal controller/view relationship, your code is more suited to normal controller/view usage than that of the template parser class. For instance, in your view, you are trying to use $title, but template parser class usage would require {title}. Also, in your controller, you are building up a $data array, but your foreach statement would create an array with numeric indices. I don't believe there is any way for you to access the data like that. There's really no reason to use the template parser class if you are the dev and designer.
  13. When I run this in php, I don't get any errors: <?php $_background_image = "url(../../graphics/graphic.png)"; echo $_background_image;
  14. Look for tutorials on pagination
  15. Most file upload tutorials will cover how to check the uploaded file to determine if it is evil.
  16. please post your output
  17. Thanks for your help. I wish I knew more about javascript, but I don't use it enough.
  18. So then something like this is more kosher?: function do_calc() { var inputs = document.getElementsByTagName('input'); var allowed = new Array("I_something","I_another","I_whatever","I_thing"); var radios = new Array(); var section1_total = 0; for(var i = 0; i < inputs.length; ++i) { for(var j = 0; j < allowed.length; ++j) { if (inputs[i].name == allowed[j]) { radios.push(inputs[i]); } } } for(var x in radios) { if(radios[x].checked == true) { section1_total += parseInt(radios[x].value); } } document.the_form.section1_total.value = section1_total; } It works too.
  19. The problem is, there are many others in the actual implementation of the code, and I was hoping to make the code as small as possible. I'm not super good at javascript (obviously), so I wasn't aware that eval was evil.
  20. This ends up working, but I don't know if it is the best way: <script type="text/javascript"> function calculate_totals() { $section1_total = 0; var names = ["I_something","I_another","I_whatever","I_thing"]; for ( var x in names ) { // each radio button set has three options, but none are required for (i = 0; i < 3; i++) { var element_checked = "document.the_form." + names[x] + "[" + i + "].checked"; if (eval(element_checked) == true) { var element_value = "document.the_form." + names[x] + "[" + i + "].value"; $section1_total += parseInt(eval(element_value)); } } } document.the_form.section1_total.value = $section1_total; return; } </script>
  21. Here is what doesn't work: <?php if( isset( $_POST ) && ! empty ( $_POST ) ) { echo "<pre>"; print_r ( $_POST ); echo "</pre>"; } ?> <script type="text/javascript"> function calculate_totals() { $section1_total = 0; var names = ["I_something","I_another","I_whatever","I_thing"]; for ( var x in names ) { // each radio button set has three options, but none are required for (i = 0; i < 3; i++) { var form_element = names[x] + [i]; if (document.the_form[form_element].checked == true) { $section1_total += parseInt(document.the_form[form_element].value); } } } document.the_form.section1_total.value = $section1_total; return; } </script> <form name="the_form" action="" method="post" onSubmit="calculate_totals();"> <p>Something</p> 1<input type="radio" name="I_something" value="1" /><br /> 3<input type="radio" name="I_something" value="3" /><br /> 5<input type="radio" name="I_something" value="5" /> <p>Another</p> 1<input type="radio" name="I_another" value="1" /><br /> 3<input type="radio" name="I_another" value="3" /><br /> 5<input type="radio" name="I_another" value="5" /> <p>Whatever</p> 1<input type="radio" name="I_whatever" value="1" /><br /> 3<input type="radio" name="I_whatever" value="3" /><br /> 5<input type="radio" name="I_whatever" value="5" /> <p>Thing</p> 1<input type="radio" name="I_thing" value="1" /><br /> 3<input type="radio" name="I_thing" value="3" /><br /> 5<input type="radio" name="I_thing" value="5" /> <p>Submit</p> <input type="hidden" name="section1_total" value="" /> <input type="submit" value="submit" /> </form>
  22. I tried to take this script and make an array of form element names, and then use them in a for in statement, but I wasn't doing it right. This script works. It calculates the totals of some radio buttons, and then sends that total along with a posted form, where it is processed by php. I just want to simplify it, and am apparently a little rusty (or I suck) at javascript. function calculate_totals() { $section1_total = 0; for (i = 0; i < 3; i++) { if (document.form_8.I_something[i].checked == true) { $section1_total += parseInt(document.form_8.I_something[i].value); } } for (i = 0; i < 3; i++) { if (document.form_8.I_another[i].checked == true) { $section1_total += parseInt(document.form_8.I_another[i].value); } } for (i = 0; i < 3; i++) { if (document.form_8.I_whatever[i].checked == true) { $section1_total += parseInt(document.form_8.I_whatever[i].value); } } for (i = 0; i < 3; i++) { if (document.form_8.I_thing[i].checked == true) { $section1_total += parseInt(document.form_8.I_thing[i].value); } } document.form_8.section1_total.value = $section1_total; return; } So you can see where there is some obvious repetition here. The problem was that when I was trying to use the name of the radio button set inside of the "document.form_8.xxxxxx.value", it wouldn't work. Is this possible?
  23. I'm trying to putput a number that is added, but it is instead combining strings: <script type="text/javascript"> function calculate_totals() { $section1_total = 0; for (i = 0; i < 3; i++){ if (document.form_8.I_Irregular_menstrual_cycle[i].checked == true) { $section1_total += document.form_8.I_Irregular_menstrual_cycle[i].value; } } for (i = 0; i < 3; i++){ if (document.form_8.I_Water_retention[i].checked == true) { $section1_total += document.form_8.I_Water_retention[i].value; } } document.form_8.section1_total.value = $section1_total; return; } </script> <form name="form_8" id="form_8" action="examine-post.php" method="post" onSubmit="calculate_totals();"> <input type="radio" id="a1" name="I_Irregular_menstrual_cycle" VALUE="5"> <input type="radio" id="a2" name="I_Irregular_menstrual_cycle" VALUE="66"> <input type="radio" id="a3" name="I_Irregular_menstrual_cycle" VALUE="777"> <input type="radio" id="b1" name="I_Water_retention" VALUE="5"> <input type="radio" id="b2" name="I_Water_retention" VALUE="66"> <input type="radio" id="b3" name="I_Water_retention" VALUE="777"> <input type="hidden" name="section1_total" value="" /> <input type="submit" value="submit" /> </form>
  24. Any basic simpleXML tutorial should do. The examples in the php.net documentation should help too.
×
×
  • 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.