jeff5656 Posted September 20, 2009 Share Posted September 20, 2009 If $_GET['pt'] is something like smith, john, I do this <input type="text" size="12" name="lname" value="<?php echo substr($_GET['pt'],0,strpos($_GET['pt'],','));?>"/> to only include the last name in this value. But if there are no commas, that field is blank. How do I re-write this such that IF there are NO commas, then make the value ALLof $_GET['pt']? Quote Link to comment https://forums.phpfreaks.com/topic/174931-strpos-question/ Share on other sites More sharing options...
RussellReal Posted September 20, 2009 Share Posted September 20, 2009 $h1 = explode(',','john,smith'); //$h1[0] = john //$h1[1] = smith Quote Link to comment https://forums.phpfreaks.com/topic/174931-strpos-question/#findComment-921905 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.