Web Hosting Talk







View Full Version : Back, with another PHP question =P


Looie
12-04-2007, 04:28 PM
$var = $_POST['info'];



How do I make it so that, whatever they put in the "info" input, it will append ".ext" to the end?

Thanks :)

Tom P
12-04-2007, 04:34 PM
Hello Looie,

In PHP the full stop (.) concatenates, that is it joins strings together. So the use would be:

$var = $_POST['info'] . '.ext';

Looie
12-04-2007, 04:38 PM
Thanks for the quick help :)

BlueHayes
12-04-2007, 07:12 PM
I don't want to complicate things too much but also remember to prevent any sort of security flaws by protecting your user-submitted inputs. Ie, remember that ANYTHING can be put into the $_POST['info'] variable by the user unless you protect it server side. I wish you good luck, Looie :)

Looie
12-04-2007, 07:25 PM
Thanks for the advice. I'll have to look into this stuff once I figure out how everything works properly.