php - Is there a way to ignore isset and display result -
may easy can't understand this.
i have 2 pages both lead third page. in third page have
if(isset($_get['something']) && isset($_get['somethingelse'])) { $something = $_get['something']; $somethingelse = $_get['somethingelse']; //more stuff here }
from page1.php
page3.php
1 url
<a href="page3.php?something='.$something.'&somethingelse='.$somethingelse.'">click</a>
and page3.php show expected. problem page2.php
page3.php
. there link like
<a href="page3.php?something='.$something.'">click</a>
so page3.php doesn't load since there check somethingelse
.. how can ignore isset without delete because need value of $somethingelse
when comes page1.php
. can't think solution here.
you can't ignore if statement, whole point of flow control. want something, if it's passed if statement. if want define $somethingelse if it's in $_get variable, , allow script continue executing if $_get['somethingelse'] empty, then:
if(isset($_get['something'])) { $something = $_get['something']; $somethingelse = $_get['somethingelse'] ?: false; //more stuff here }
Comments
Post a Comment