Info from forms as PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Fuzzyhaggis
Forum Newbie
Posts: 2
Joined: Wed Aug 17, 2005 3:40 am

Info from forms as PHP

Post by Fuzzyhaggis »

I want a script to take text from a form field (that a user has typed) and treat it as php so that a $string variable typed in will be replaced with its value.

How do I do this - I'm beginning to get a headache over it!
User avatar
thomas777neo
Forum Contributor
Posts: 214
Joined: Mon Mar 10, 2003 6:12 am
Location: Johannesburg,South Africa

Post by thomas777neo »

Could you please give us some more information regarding what you want to do exaclty if you could do what you requested.

I think there is a logical error somewhere, maybe we can help you out with an easier solution
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

Fuzzyhaggis
Forum Newbie
Posts: 2
Joined: Wed Aug 17, 2005 3:40 am

Post by Fuzzyhaggis »

Yep, for example - if a person types:

blah blah $string blah blah

And hits "submit", the script will change $string into whatever it's supposed to be.

I know about $_POST and all that stuff but thanks for pointing it out anyway!
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

Look into http://uk2.php.net/eval , but be very clear what you allow users to enter there. Otherwise your server gets hacked in no time.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

could use a template engine like replacement tool.. I've posted how to do that far too many times..
Post Reply