...

View Full Version : Run a string through PHP



ItsGreg
10-26-2010, 12:48 PM
Hi!

I have a form, to create a new page in PHP. So, when I enter page title, and send the form over, the title will be processed into a shorter string, without special characters and spaces. What I want is, the title to be processed immediately, and displayed under the input.
Help please?

Thanks.

Spudhead
11-03-2010, 06:07 PM
Hi!

I have a form, to create a new page in PHP. So, when I enter page title, and send the form over, the title will be processed into a shorter string, without special characters and spaces. What I want is, the title to be processed immediately, and displayed under the input.
Help please?

Thanks.

Option 1:
Use AJAX to post your text input to a PHP page that simply echos the processed version of whatever it receives. Drop that AJAX response into a holding element underneath your form input field.
Pros: actual PHP-processed content
Cons: delayed response

Option 2:
Create javascript versions of the PHP functions you'll be using, and run your input values through that. (http://phpjs.org/pages/home)
Pros: instant response
Cons: possible variation between JS and PHP implementation

sybil6
11-04-2010, 02:56 AM
It depends if youre keeping your data in a database or not, to just show a title wich was inserted by a user thru a input text field does not require Ajax if no Database is in between.

Check this:
http://daniel.lorch.cc/docs/ajax_simple/

It will help you to understand the basics.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum