answersLogoWhite

0


Best Answer

isset( $var ) is a PHP function which returns TRUE or FALSE depending on whether a specified $var has been assigned to any value (or, initialized).

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is isset in php?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you get a cookie on a certain page?

Its an easy PHP code


How do you use a function with a button in PHP?

A simple function call <html> <body> <?php if(isset($_POST['button'])) { setValue(); // Function is called } function setValue() { echo "<br>The button property to call PHP function works"; // Your code here } ?> <input type="submit" name="button" onclick=<?php $_SERVER['PHP_SELF']; ?> /> </body> </head>


When I try to use isset it is not working. How to solve it?

I am certain isset() is working exactly the way it is supposed to. Check that you are using the correct function for what you need to do, it might not be isset() that you want to be use.


How can you create a calculator using PHP?

Result:


Who is Ruth isset?

She is a textile artist


How do you create a simple questionnaire using php?

Here's a quick example on how to do it. <?php if(isset($_POST['send'])) { if($_POST['answer'] == 'My Answer') echo 'You got it!'; else echo 'Wrong answer.'; } ?> <form method="post" action="you_file_name_here"> What is the answer to this question? <br> <input type="text" name="answer"> <input type="submit" name="send" value="Check it!"> </form>


How do you create php web counter and prevent it from counting when returned to the subpages?

I made a few weeks ago: session_start(); //you can also use a cookie, I prefer session. error_reporting(0); //to avoid notice in checking if counted. if(!isset($_SESSION['cont'])) { //check if not counted yet. error_reporting(E_ALL); //activate error reporting again. $dir = 'PATH FOR THE VAR TO BE SOTRED IN'; //THIS MUST BE A PHP file !! if(include($dir)) { if(isset($cnt)) { $cnt ++; $cntr = '<?php'.sprintf(PHP_EOL).' $cnt = '.$cnt.';'.sprintf(PHP_EOL).' ?>'; file_put_contents($dir, $cntr); $_SESSION['cont'] = true; } else { $cnt = 1; $cntr = '<?php'.sprintf(PHP_EOL).' $cnt = '.$cnt.';'.sprintf(PHP_EOL).' ?>'; file_put_contents($dir, $cntr); $_SESSION['cont'] = true; } } else { echo 'Wrong file path '.$dir; } } Good luck :)


What php command to be used to redirect visitotors to customized thank you page after submitting the form?

You should write this line of code before any text is sent to the browser. Remember, even the HTML tag counts. So you can type: <?php if (isset($_POST['submit'])) header("location:http://www.mywebsite.com/thankyou.php"); ?> Remember that if statements and other PHP statements that don't actually send output would work, but any output sent to the browser won't. Be careful of that!


Write a PHP program to check whether the number is palindrome or not?

This program only suits PHP. If you want a proper one try C program for it available on web <body> <?php if(isset($_POST['submit'])) { $text = $_POST['text']; $string = mysql_real_escape_string($text); $invert = strrev($string); if($string == $invert) { echo "<br>Given number is a palindrome!!"; } else { echo "<br>Given number is not a palindrome!!"; } } ?> <form method="post"> <input type="text" name="text" id="text" /> <input type="submit" name="submit" value="Submit" id="submit" onclick="<?php $_SERVER['PHP_SELF']; ?>" /> </form> </body>


What is 10 percent in Php 250?

Answer: Php 2510% of Php 250= 10% * Php 250= 0.10 * Php 250= Php 25


How can you use a JavaScript variable in the PHP isset function?

You can't actually do that. There is no direct way to make JavaScript code talk to PHP code, as the two languages are interpreted in different locations. The PHP is interpreted by the server, and the JavaScript is interpreted by the client. This means it's easy enough to transfer data from PHP to JavaScript (by generating the JavaScript with the PHP), but not the other way around. If you're simply looking for a way to see if a JavaScript variable is set (from within the JavaScript itself), that can be done with a line like this one: if(myVariable !== undefined){ /* do stuff */} If you actually want to handle it on the PHP side, one way to do so would be to use additional PHP code when that happens. For example: <?php $jsVars = array(); ?> <script type="text/javascript"> var foo = 'bar'; <?php $jsVars['foo'] = 'bar';?> var yub = 'nub'; <?php $jsVars['yub'] = 'nub';?> </script> ... You can then check to see whether a certain variable has been set by seeing if it's in that array: <?php function jsIsset($varname){ global $jsVars; return array_key_exists($varname, $jsVars); } ?> This however, only works when the JavaScript is generated, not when it's interpreted by the client system. For example, imagine you have a variable that is defined by a JavaScript function that is called from an onclick event. By the time that event happens, the page has already been served and the PHP is done executing. If you want the JavaScript to tell the PHP that a variable is defined, you would need to do it through an AJAX request, which I believe is beyond the scope of this question.


I'm trying to see how many times a file is included.how it is possible in php?

If it's just a single file, you could do it by adding a counter at the head of the file. Something like this: $incTally = isset($incTally) ? $incTally + 1 : 1; If you need something more elaborate, such as tracking the include frequency for all files, you could do it by adding this code at the top of all files: if(!isset($incTally)){ $incTally = array(); } if(array_key_exists(__FILE__, $incTally)){ $incTally[__FILE__]++; }else{ $incTally[__FILE__] = 1; } Which would give you an array listing the number of inclusions for every file that includes that header.