iammudassir Posted December 4, 2012 Share Posted December 4, 2012 i have a field field1 value ="<?php if(isset($_POST['submit'])){echo $row[1]; }?>" $row[1] is result because of a query some times $row[1] is present and some times no if not present it generate an error how i set my php code in value to check after submit is $row[1] is present or not to echo it Link to comment Share on other sites More sharing options...
justsomeguy Posted December 4, 2012 Share Posted December 4, 2012 If you want to know if $row[1] is set then why are you checking if $_POST['submit'] is set? Why not check for $row[1]? Link to comment Share on other sites More sharing options...
iammudassir Posted December 6, 2012 Author Share Posted December 6, 2012 actually i want to check both select and $row[1] because when i press select button it will execute a query and $row[1] is the result of that queryso i want to check if select is pressed and my query has $row[1] then echo it Link to comment Share on other sites More sharing options...
thescientist Posted December 6, 2012 Share Posted December 6, 2012 if the query never executed, because the form was never submitted, then $row[1] would never have been set, so why not just check for $row[1]? it might help if you post all of your relevant code. Link to comment Share on other sites More sharing options...
justsomeguy Posted December 6, 2012 Share Posted December 6, 2012 actually i want to check both select and $row[1] because when i press select button it will execute a query and $row[1] is the result of that queryso i want to check if select is pressed and my query has $row[1] then echo itFine, then check for both of them. My point is that if $row[1] is not set, and you want to avoid that error message, then you need to check if $row[1] is not set. If you want to check more than just that, then go ahead. 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