从表单中删除文本

时间:2009-07-02 23:11:42

标签: php html forms

这是输入表单代码

<tr valign="top">
    <td align="right" class="innertablestyle"><font class="normal"><strong>Homepage</strong></font></td>
    <td>&nbsp;</td>
    <td>
        <font class='normal'>
            http://
            <input name="website" type="text" id="website" value="<?php echo $website; ?>">
            &nbsp;
        </font>
        <font class="normal">&nbsp; </font>
    </td>
</tr>

这是显示代码

<tr > 
<td height="25" class="selllink"> Website 
Address<font class="h2">&nbsp;&nbsp;&nbsp; 

<?php 
$group_set=mysql_fetch_array(mysql_query("select * from b2b_groups where sb_memtype=".$mem["sb_memtype"])); 
if(($sbrow_off["sb_website"]<>"")&&($group_set["sb_posturl"]=='yes')) 
{echo "<a href='http://".$sbrow_off["sb_website"]."' target='_blank'>".$sbrow_off["sb_website"]."</a>"; } 
else 
{echo $config["sb_null_char"];} 
?> 
</font></td> 
</tr> 

表单,用于收集用户的url以存储在数据库中。他们不应该使用他们的URL输入http://但是很多,结果就是当他们的网址显示时它看起来像这样

http; // http://www.foo.com我需要表单来剥离或忽略它,或者你认为最好的处理方式。

1 个答案:

答案 0 :(得分:2)

if (stripos($website, "http://") === 0) 
    $website = substr($website, 7);