GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Form validation in PHP (https://gfy.com/showthread.php?t=347982)

whee 08-28-2004 12:21 PM

Form validation in PHP
 
Form validation in PHP

When someone enters a string similar to this in my address input field:

Some street 98, 1'st floor.

I get an error due to the ' char. It's substituted by / and a space!
This is no good...

Does anyone have the valid php ereg function to disable or replace the illigal chars like ' & // $ etc etc... ?

If someone enters something like this in a form that submits it to a php page, it errors on me big time.

:helpme

Anothers 08-28-2004 12:38 PM

try addslashes();


example

<? php

echo "This is correct field value: ".addslashes($_POST["form_field"]);

?>


Edited: there is space between '<?' and 'php' - just remove it to get it work

Edited 2: whe your form method is GET then change $_POST to $_GET

whee 08-28-2004 01:03 PM

Great idea... Thanks!


All times are GMT -7. The time now is 01:33 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123