Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Re-Run Function Button?

Name: Anonymous 2009-07-30 3:23

Yesterday I started writing a script to generate random information which I could use to create NPCs for my Dungeons and Dragons games. I decided that if I was going to be unattractive to women, I may as well not hold back, ya know?

Anyway, I've never actually coded in PHP before, so this has been a bit of a struggle. But things are coming along at a decent pace. I've managed to complete all but one of the tasks I set out to complete in version 2 of the script.

I want the user to be able to "re-roll" one of the variables if they don't like the result, or if the result is incompatible with one of the other results. But I've been trying to solve this problem off and on for the last six hours or so, without any significant breakthroughs.


<?php

//BEGIN RANDOM ALIGNMENT
   
    function align_rand($align){
        $g = $align[mt_rand(1, 3)];
        $l = $align[mt_rand(4, 6)];

        if($g=="Neutral" && $l=="Neutral"){
            $ment = "True Neutral";
        }
        else{
            $ment = $g." ".$l;
        }

        return $ment;

    }

//END RANDOM ALIGNMENT

?>

    <br /><br /><b>Alignment is: </b>
    <?php echo align_rand($align); ?>


If possible I'd like for the "re-roll" button to take the form of a hyperlink rather than a button, but whatever gets the job done at this point is fine with me.

Again, any help would be greatly appreciated. Thank you in advance, and I eagerly await your response.

Name: Anonymous 2009-07-30 3:53

$_POST and $_GET and go away.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List