Hi,

This is part of my code

$query1 = "INSERT INTO aacl_match (`id`, `team`, `ladder`, `time`, `date`, `map`) VALUES ('', '$teamnamme', '$ladderd', '$randomtime', '$randomdate', '$randommap')";		
		$result1 = mysql_query ($query1) or trigger_error("Query: $query1\n<br />MySQL Error: " . mysql_error());

$dbid = (mysql_insert_id());

if(isset($_POST['finishchallenge2'])){

echo "$dbid";

}

Because I echoed after the isset it does not work if I put it before it does why wont it work when its after

Thanks

    Most likely because $_POST['finishchallenge2'] is not, in fact, set?

      Well, your if condition does an isset() on that variable to see if it is set (defined). If it is not set, then the code within the following {...} block will not be executed. Therefore, it would seem that it is not set in your post data. Perhaps you misspelled the array key (note that it is case-sensitive)?

        If I was to add

        echo "test
        $game
        ";
        

        I was see test but the variable $game would be blank it is

        $game =$_POST['game'];
        

        before the isset but it seems to reset after the isset its echoing fine before the isset as well so it must be setting

        Thanks

          It may "seem" to reset after the isset, but unless you have discovered a PHP bug that no one else to my knowledge has found, more likely there is either a logic error or a spelling error in your code.

          You may find it useful to ensure all warnings/notices are displayed to help discover where things go wrong:

          <?php
          ini_set('display_errors', 1);
          error_reporting(E_ALL);
          // . . . rest of script . . .
          ?>
          

            Intresting, it came back with some errors I think I have done this wrong

            if ($ladderd == eu2){
             $ladder = 'aeu2';
            }
            
            if ($ladderd == eu4){
            	$ladder = 'aeu4';
            }
            
            if ($ladderd == eu6){
             $ladder = 'aeu6';
            }
            
            if ($ladderd == eu8){
             $ladder = 'aeu8';
            }
            
            if ($ladderd == eu12){
            	$ladder = 'aeu12';
            }

            Its coming up with an error here

              Oh I fixed this by added '' e.g.

              if ($ladderd == 'eu12'){

              So thats fixed but this $ladder variable done by the if statment above this post is still not working but works fine above the isset

                So how do I carry the varaible to the isset

                  Write a Reply...