Jump to content

isset help


Clinton

Recommended Posts

Ok, Premiso... I did not enter anything into that line (dtypewc) so why did it "set"? How does something "set"? I looked up in the manual but it doesn't say how a variable set's.

 

 

Thanks for the empty link btw.

 

How is $dtypewc being populated?

 

If it is from a form, chances are register_globals is on and I would suggest turning them off or coding like they are off.

 

Basically register_globals converts and form/session/cookie data to an actual string. So a form with a field name of dtypewc will out populate $dtypewc, when you should do something like this to assign the variable...

 

<?php
$dtypewc = (isset($_REQUEST['dtypewc']) && !empty($_REQUEST['dtypewc']))?$_REQUEST['dtypewc']:false;
?>

 

Then your if would be

<?php 
$dtypewc = (isset($_REQUEST['dtypewc']) && !empty($_REQUEST['dtypewc']))?$_REQUEST['dtypewc']:null;

if (!is_null($dtypewc))
{ ?>
      <tr><td id='header'>
      Will Consider a <?php echo $dtypewc; ?>.
      </td></tr>
<?php }    ?>

 

That is assuming that is what is happening.

Link to comment
https://forums.phpfreaks.com/topic/139589-isset-help/#findComment-730249
Share on other sites

It's an option on a form, text type, then the form INSERTS all info into the db.

 

It's actually being populated by SELECT then extract_row().

 

Then it is coming out of the DB it has a value of "" so the variable is created, meaning it was set, thus why you would need to check empty to check if that value has any data or not.

 

You could even remove the isset if you wanted to and just check the empty.

Link to comment
https://forums.phpfreaks.com/topic/139589-isset-help/#findComment-730273
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.