I have a basic form and want the results to display on the same page. I have come up with some code below but it does not work. Can someone help? <html> <body> <form action="form.php" method="post"> No. of Characters used: <input type="text" name="char" /><br><br> Combination size: <input type="text" name="size" /> <input type="hidden" name="send" value="check"> <input type="submit" /> </form> </body> </html> <?php $send = $_GET["send"]; if (!(isset($send))) { $send = $_POST["send"]; } $characters = $_POST["char"]; $charlength = strlen($characters); $combinations = $_POST["size"]; $possibilities = pow($charlength,$combinations); if ($send=="check") { echo "Characters = " $charlength; echo "<br>"; echo "Combination Size = $combinations."; echo "<br>"; echo "Combinations = $possibilities.";} ?> PHP: Basically it is a script for determining how many possible combinations (including repeats) you can have when you have an X amount of possible characters (numbers or letters or other stuff) and Y digits long.
echo "Characters = " $charlength; echo "<br>"; echo "Combination Size = $combinations."; echo "<br>"; echo "Combinations = $possibilities.";} PHP: The first part just displays what I entered into the 'no. of characters used' The other two parts just display '1'. I have a working example for a form with two separate files here. This shows how I want the script to work. Thanks
In your code, thats not actually "No. of Characters used:". Its just "Characters" as in example page. You need need to put the actual characters like "abcxyz" in first field and code is counting the "number of characters used" itself. Theres nothing wrong with the wrong, except: echo "Characters = " $charlength; should be: echo "Characters = " . $charlength; or echo "Characters = ", $charlength; or echo "Characters = $charlength";
Cybernaut Thank you for your reply. I have now managed to get the script working. I plan to release it in the freebie section soon when I have put a lot more features on it.