PHP Question (Full Version)

All Forums >> [Web Development] >> General Web Development



Message


emtohio -> PHP Question (6/8/2009 19:45:45)

I operate an EMS Job Website and had someone build a database for me. When posting a job to our website;

http://www.fieldmedicsjobs.com/forms/postjob.htm

In the text area to describe the job I guess the employers are just cut and pasting from another document. I get all kinds of crazy symbols when its posted to the site; example

A dispatcher’s responsibility

and

• Experience in ambulance dispatching.
• Knowledge of medical terminology.
• Experience with customer service.

I am assuming they were suposeed to be bullets but not sure, as for the first example I have no idea what caused it.

I am not very good with PHP yet so what I have come up with so far is just to disable the HTML in the text area

I have found this code <textarea onchange="this.disabled = true"></textarea>

But it does not seem to work. Where ever I put it it knocks out my drop down menu for my States in the form.

Can anyone help me or tell me what I should do or what I am doing wrong?




ppruck -> RE: PHP Question (6/9/2009 2:00:30)

this should remove non ascii chars from a string :

<?php
$string = "place the string you need to clear here";
$string = preg_replace('/[^(\x20-\x7F)]*/','', $string);

?>

i did test it on the examples you gave and it removed the unwanted ones no problem.





Giomanach -> RE: PHP Question (6/9/2009 13:56:27)

I'll explain on ppruck's answer a little more.

PHP uses non-ascii characters to parse information, to perform certain actions. If these are found in query criteria, it will change them to something it understands better - not always what is wanted. Using the code ppruck provided you remove that problem by "replacing" it with something else, meaning the PHP won't produce funky characters ;)




emtohio -> RE: PHP Question (6/11/2009 11:12:35)

Where do I add this in the code. I added it to the page and it still get this on a test post.


-----------------
Rrrrrrrrrrrrrrrr
Rrrrrrrrrrrrrrrrrr
Rrrrrrrrrrrrrrrrrrrrrrr
• Rrrrrrrrrrr
• Tttttttttttt
• Yyyyyyyyyyyy
• Uuuuuuuuuuuu
• Iiiiiiiiiiiiiiiii

/> Uuuuuuuuugfh
Gf
Hfgh
f
---------------------------

this is what I posted

Rrrrrrrrrrrrrrrr
Rrrrrrrrrrrrrrrrrr
Rrrrrrrrrrrrrrrrrrrrrrr
• Rrrrrrrrrrr
• Tttttttttttt
• Yyyyyyyyyyyy
• Uuuuuuuuuuuu
• Iiiiiiiiiiiiiiiii
Uuuuuuuuugfh
Gf
Hfgh
f




thanks for the help.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.3125