john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

php form to tree diagram

<?php
    include( $_SERVER["DOCUMENT_ROOT"] . "/includes/head.txt");
    //john pfeiffer 2010-06-03 php take user input form and make tree diagram (wc2010)
    //todo get and list items from user
    //break items into rankings groups (wc2010 groups?)
    //display winners tree from tournament to final?


?>

<body onload="document.entryform.searchfield.focus()"> <!-- default cursor -->

    <form name="entryform" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
        Multiple spaces between keywords, one set of keywords per line:<br />
        <textarea name="multilineentry" wrap="hard" rows="5" cols="80"></textarea>
        <br />

        <input type="Submit" value="Submit" />
    </form>

<?php

    if( !isset($_POST['multilineentry']) || empty($_POST['multilineentry'] ) )

    {
        echo "<b>You must fill in both the query and target url.</b>";
    }

    else
    {
        $multilineentry = nl2br( $_POST['multilineentry'] );   //convert line breaks to <br />
        $multilineentry = explode( "<br />", $multilineentry );

        print_r( $multilineentry );

        echo "<br />\n";
        echo '<table border="1">';

        for( $i=0; $i< sizeof( $multilineentry ) ; $i++ )
        {
            $line = trim( $multilineentry[$i]);    //ensure no leading/trailing whitespace!
            echo "<tr><td>";
            echo $line;
            echo "</td></tr>";


         }
         echo "</table>";

    } // end else

?>


<br />&nbsp; <br />

<?php //include date modified
    include( $_SERVER["DOCUMENT_ROOT"] . "/includes/foot.txt");
?>

<?php //include the google analytics javascript
    include( $_SERVER["DOCUMENT_ROOT"] . "/includes/google-code.htm");
?>

</body>
</html>

  • « file cat
  • find backup »

Published

Jun 17, 2010

Category

php

~161 words

Tags

  • diagram 3
  • form 20
  • php 82
  • to 63
  • tree 2