• (cs) in reply to nerdierthanu
    nerdierthanu:
    shadowman:
    bighusker:
    joh6nn:
    from a "time spent" perspective, this copy-paste monstrosity is probably a lot faster than actually good solution.

    I really don't see how this is faster than coding each radio button once and determining if it should be checked within each radio button tag. The only person who would do something this way is a person without any real web development experience.

    $education = array("High School","Some College"); // and so forth
    
    foreach ($education as $ed) {
    	print "<input type='radio' name='EducationID' value='" . $ed . "' ";
    	if ($_SESSION["EducationID"]==$ed) print "checked";
    	print " />" . $ed . "
    "; }

    I didn't know you could do that!

    While that's an entirely acceptable way of doing it, I prefer an alternative which has a little duplication, but I find much easier to read...

    $education = array("High School","Some College"); // and so forth
    
    foreach ($education as $ed) {
    	if ($_SESSION["EducationID"]==$ed) {
    		print "<input type='radio' name='EducationID' value='" . $ed . "' checked />";
    	} else {
    		print "<input type='radio' name='EducationID' value='" . $ed . "' />";
    	}
    }
    

    Granted, if I was doing this in php from scratch, I'd probably use embedded HTML, rather than print statements,

    <?php
    $education = array("High School","Some College"); // and so forth
    
    foreach ($education as $ed) {
    	if ($_SESSION["EducationID"]==$ed) { ?>
    		<input type='radio' name='EducationID' value='<?=$ed?>' checked />";
    <?php	} else { ?>
    		<input type='radio' name='EducationID' value='<?=$ed?>' />";
    <?php	}
    }
    ?>
    
  • nano (unregistered)

    Woah random_garbage, it's amazing how you used PHP to go from elegant to ugly in such a short step. I'd congratulate you, but really I should save the praise for PHP itself.

  • sdfsf (unregistered)

    WTF

  • few (unregistered) in reply to joh6nn

    Cheap fantastic top quality Dr dre beats pro In inclusion to your Monster Beats By Dre This Monster Beats Headphones time he came to kill lie yen tailor, is. dr dre beats studio Of course he is also a father-in-law hand in of the Lingual. Monster Cable BeatsHis heart was in fact doing believe his soul than lie yen tailor knife method of traveling with soul nine swords. The age of the river’s lake is light, the Monster Beats By Dre famous four fingers, and he is only four killer fingers. The world has thought is four refers to defect, but are often flaws, become deadly become advantage. For liana, have to say he is a genius, monster beat dr dre and not just because he is obsessed with the sword, but that kind of understanding and drive.Monster Beats By Dre The world’s Monster Beats EarphonesBeats by Dre Professional Headphones great powers not advanced liana, but not afraid dead of work force. This person is not much, but doesn’t mean no. Just four fingers. Monster Headphones Australia , is this kind of person. Monster Beats Headphones So he made his debut in the fourth year, “four refers to the killer” introverted name already from Monster Beats By Dre river’s lake. Two people at this time is the up and down at the sky, who also didn’t go to see the bodies of enmity between bad look. Monster Beats Solo A dead man just, even if he was brilliant again, also just a dead man. This world is not important, the dead is important to the Monster Beats By Dre living.

Leave a comment on “Only $0.001 per Line”

Log In or post as a guest

Replying to comment #:

« Return to Article