Jump to content

strpos question


jeff5656

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.