dc_jt Posted November 16, 2006 Share Posted November 16, 2006 I have a form where the user can add a url using a text field. I want to be able to have 'http://' in the text field all the time so they always put this before their website.I have the following:[code] <td >URL</td><td ><input class="fmfield200" type="text" name="url" value="<?=(isset($_POST['url']))?$_POST['url']:$aListing['url']?>"/></td> </tr> <tr>[/code]How can I put it into this?Thanks Link to comment https://forums.phpfreaks.com/topic/27449-default-value-in-text-field/ Share on other sites More sharing options...
Orio Posted November 16, 2006 Share Posted November 16, 2006 [code]<td>URL</td><td><input class="fmfield200" type="text" name="url" value="<?phpif(isset($_POST['url']) && strpos($_POST['url'],"http://") === FLASE) echo "http://".$_POST['url'];elseif(isset($_POST['url']) && strpos($_POST['url'],"http://") !== FALSE) echo $_POST['url'];elseif(strpos($aListing['url'],"http://") === FASLE) echo "http://".$aListing['url'];else echo $aListing['url'];?>"/></td></tr>[/code]Orio. Link to comment https://forums.phpfreaks.com/topic/27449-default-value-in-text-field/#findComment-125538 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.