|
 |
beginning_php thread: eregi - help
Message #1 by "G.S." <gsadmin@l...> on Tue, 11 Feb 2003 07:28:17 +0100
|
|
if the answer to the question 1 is : What is your pet's name?
if the answer to the question 2 is : What is your father's middle name?
the result is:
What is your pet\'s name?
What is your father\'s middle name?
I want .. pet's name
and not .pet\'s name
thanks
GheSca
<?php
if ($submit) {
require_once("function.php);
$register = $abcde->register ($question1, $question2);
if ($register == 1){
echo "$question1<br>$question1";
}else{
echo "Error";
}
}
<?
<html><head><title>aa</title></head><body>
<form name="form1" method="POST" action="<?php echo $PHP_SELF; ?>">
<INPUT TYPE="text" NAME="question1" size="20" value="<?php echo $question1;
?>"><br>
<INPUT TYPE="text" NAME="question2" size="20" value="<?php echo $question2;
?>"><br>
<INPUT TYPE="submit" NAME="submit" VALUE="submit"><br>
</form>
</body></html>
//........file function.php
<?php
class abcde {
function register ($question1, $question2) {
if (!$question1 || !$question2) {
return $this->error[1];
}else{
if (!erregi("^[a-z0-9 '?]+$",($question1)) {
return $this->error[2];
}
if (!eregi("^[a-z0-9 '?]+$",($question2)) {
return $this->error[3];
}
return 1;
}
}
var $error = array
(
"Error 1 Bla bla bla",
"Error 2 Bla bla bla",
"Error 3 Bla bla bla"
};
}
$abcde = new abcde;
Message #2 by "Nikolai Devereaux" <yomama@u...> on Tue, 11 Feb 2003 11:48:09 -0800
|
|
> if the answer to the question 1 is : What is your pet's name?
> if the answer to the question 2 is : What is your father's middle name?
>
> the result is:
>
> What is your pet\'s name?
> What is your father\'s middle name?
>
> I want .. pet's name
> and not .pet\'s name
Use this: http://www.php.net/stripslashes
Take care,
Nik
|
 |