By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,746 Members | 1,924 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,746 IT Pros & Developers. It's quick & easy.

What is wrong?

P: n/a
test.php

<form action = "test1.php" method = "POST">
<p>
<b>Interests:</b>
<br>
<input type = "Checkbox" name = "interests[]" value =
"politics">Politics
<input type = "Checkbox" name = "interests[]" value =
"economy">Economy
<p>
<input type = "Submit" name = "submit" value = "Save">
</form>
</form>
text1.php:

<?
include("test2.php");

$fp = new FormProcessor();

$fp->valid(
"interests",
"array",
LETTERS,
'The interests are valid.',
'The interests are invalid!'
);
?>
test2;php

<?
define('LETTERS', '/^[-+]?\\b[a-zA-Z]*\\.?[a-zA-Z]+\\b$/');

class FormProcessor
{
private function getValue($field)
{
if($field == "interests")
{
echo $field;
echo $value;
}

global ${$field};
return ${$field};
}

public function valid($field, $type, $pattern, $warn, $alert)
{
$value = $this->getValue($field);
}
}
?>
Sep 13 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.