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

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

you can check with javascript

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

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

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

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

Comments
This is your 8th damn post, stop bumping solved threads
This question has already been answered. Start a new discussion instead.