iammudassir Posted November 27, 2012 Share Posted November 27, 2012 i have a text field like this <td width="62"> < input name="delivery_no[]" type="text" size="5" value = " <?php if(isset($_POST['select'])) // i set value here for this field { echo $rows[3]['delivery_no']; // this echo $rows is coming from a sql query } ?>"/></td> problem is that if my sql query has this result it echo here BUT when my sql query has no result my page generate an error i just required if my sql query does not have this $rows[0] my field remains blank and i can continue work on other fields. like thisif sql query has $rows[3] echo it other wise do nothing let field blank Link to comment Share on other sites More sharing options...
niche Posted November 27, 2012 Share Posted November 27, 2012 What's that vertical rectangle in your input field name? Link to comment Share on other sites More sharing options...
birbal Posted November 27, 2012 Share Posted November 27, 2012 You can use issset() to determine if any variable exist or not. if exist then show up it. if you want to know your query is really returning rows or not, you can mysql_num_rows() or equivalant method of other api(mysqli/pdo) What's that vertical rectangle in your input field name?It is not rectangle, it is open and closed square bracets of array notation. 2 Link to comment Share on other sites More sharing options...
iammudassir Posted December 4, 2012 Author Share Posted December 4, 2012 You can use issset() to determine if any variable exist or not. if exist then show up it. if you want to know your query is really returning rows or not, you can mysql_num_rows() or equivalant method of other api(mysqli/pdo) It is not rectangle, it is open and closed square bracets of array notation.can you tell me please how to to set isset to check if variable is present please note i already set if isset $_POST['select'] Link to comment Share on other sites More sharing options...
iammudassir Posted December 4, 2012 Author Share Posted December 4, 2012 can you tell me how to set isset to check if variable is present or not with submit buttonlike this i want this type of code if select button is press check $a is present if present echo $a Link to comment Share on other sites More sharing options...
thescientist Posted December 5, 2012 Share Posted December 5, 2012 http://php.net/manual/en/function.isset.php 1 Link to comment Share on other sites More sharing options...
satishpoul Posted December 10, 2012 Share Posted December 10, 2012 if(isset($_POST['select'])){ if(isset($a)) { echo $a; }} Link to comment Share on other sites More sharing options...
iammudassir Posted December 10, 2012 Author Share Posted December 10, 2012 if(isset($_POST['select'])){ if(isset($a)) { echo $a; }} thank you for correct replycan we use && here instead of using two time IF if yes then how i wanna use && operator like thisif(isset($_POST['select'])) && if(isset($a)) ???? what wrong with this code Link to comment Share on other sites More sharing options...
satishpoul Posted December 10, 2012 Share Posted December 10, 2012 yahh if((isset(..)) && (isset(..)) && (another conditions...)) Link to comment Share on other sites More sharing options...
satishpoul Posted December 10, 2012 Share Posted December 10, 2012 don't use if in condition of another if.. like u didif(... && if() ... ) Link to comment Share on other sites More sharing options...
iammudassir Posted December 10, 2012 Author Share Posted December 10, 2012 don't use if in condition of another if.. like u didif(... && if() ... ) ok thank you sooooo much Link to comment Share on other sites More sharing options...
birbal Posted December 10, 2012 Share Posted December 10, 2012 isset() also accpets multiplr value. where the all the passed variable must have to set to return a TRUE. it is similar to using isset() with conjugation with && in 'if-else' structure. http://w3schools.invisionzone.com/index.php?showtopic=45820&view=findpost&p=255803 also you can read more about control structure and operators herehttp://php.net/language..operator.conditionalhttp://php.net/language.control_structure 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now