Hi,

I have inserted a php function on a node, that is suppose to return a number but when the submit button is clicked, it will take you to index.php instead of returning the result number.

here is my code:

$num_to_guess = 42;
$num_tries = (isset($_POST[num_tries])) ? $_POST[num_tries] + 1: 1;
if (!isset($_POST[guess])) {
   $message = "Welcome to the guessing machine!";
} elseif ($_POST[guess] > $num_to_guess) {
   $message = "$_POST[guess] is too big! Try smaller number";
} elseif ($_POST[guess] < $num_to_guess) {
   $message = "$_POST[guess] is too small! Try a larger number";
} else { // must be equivalent
  $message = "Well done!";
}
$guess = $_POST[guess];





echo $message

Guess a number: echo $num_tries;

echo $_SERVER[PHP_SELF]; " method="POST">

Type your guess here

echo $guess; ">
echo $num_tries; ">


Thanks

Comments

snufkin’s picture

Status: Active » Closed (fixed)

This is the issue queue of the installation profile drupal_developer, please ask this question on the forums as you will likely receive more attention there. Thank you.