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']? 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 Link to comment https://forums.phpfreaks.com/topic/174931-strpos-question/#findComment-921905 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.