0

Hi,

me again,

I have a textbox that users can enter a url of there website.

I have default value at http:// so when page loads the text box alreay displays http://

I am not sure what i do in PHP to check to make sure that the url starts with http://

can someone tell me what i use in PHP so it checks that the textbox starts with http:// ?

Thank you,
genieuk

4
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by rahul.anand77
0
if (!strpos(#_post['textbox'],'http://') == 0) { return false}

/* return false can be any thing, have successfully used header("location: $_server"); to bounce incorrectly filled pages back */ }
or javascript can check similarly in the <form onsubmit='javascript'> before submission

0

you can check with javascript

apply string function to check if the first 7 characters are "http://"

0

or there is an other option use http:// outside text field and let the users just enter url like www.test.com and you concatenate http:// with url

0

Hello Everyone,

Once again thanks for yout help.

I think i will use http:// outside the box and concantanate, i did not think of that.

Thank you to everyone
genieuk

-1

Hi! Just use the preg_match() to check whether the http:// is there or not and take the desired action.

Votes + Comments
This is your 8th damn post, stop bumping solved threads
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.