PDA

View Full Version : PHP Form submit & concatenating text...




bigandy
Jun 19, 2006, 08:02 AM
I'm writing a form that has a weblink in it, and i need to check that it has a "http://" at the start, and if not add it, when the form is submitted.

how would i go about doing this? i've hunted around the fishnet, but not come accross the soultion! :(



NoNameBrand
Jun 19, 2006, 08:44 AM
Lots of functions to do this. strstr() (http://ca.php.net/manual/en/function.strstr.php), for instance. It has links to other functions that will also do what you want.

Coolnat2004
Jun 19, 2006, 01:29 PM
After the form has been submitted..

if (substr($_POST['urlform'], 0, 7)!='http://') $_POST['urlform'] = 'http://'.$_POST['urlform'];