0
$newtypeid=$_REQUEST['newstype'];

$action = (isset($_REQUEST['action'])&& $_REQUEST['action'] !=NULL)?$_REQUEST['action']:'';
if($action == 'ajax'){
    echo "newtypeid is".$newtypeid;
    --------------
    //some stuff here
    }

How to get $newtypeid value inside if statement.

5
Contributors
5
Replies
27
Views
3 Years
Discussion Span
Last Post by diafol
0

Are you sure $_REQUEST['newstype'] actually has a value?

Is the text of your echo being displayed?

How are you sending through 'newstype' (post or get)?

0

yeah..$_REQUEST['newstype'] value is accesible outside if statement.
I want $newtypeid value inside if statement.
Need suggestions

0

The problem appears to be in line 3 of your code. It must not be evaluating to 'ajax' and therefore the IF condition is evaluating as FALSE.

Because if you simplify the code, the variable $newtype is working as expected within the IF block.

See this simple example..

<?php
$newtypeid=$_REQUEST['newstype'];
$action = "ajax";
if($action == 'ajax'){
    echo "newtypeid is " . $newtypeid;
    }
?>

and results...

f66deeed62766e1663364641e5ab149c

Edited by JorgeM

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.