RE: [PHP-DB] Forms
| From: | Rick Emery | Date: | Fri, 22 Mar 2002 13:06:13 +0000 |
| Subject: | RE: [PHP-DB] Forms | ||
| Groups: | php.db php.general | ||
| Request: | Send a blank email to php-general+get-89666@lists.php.net to get a copy of this message | ||
First: cross-posting to multiple lists...not nice. Most PHP folks are on
both lists.
Second: your first sentence seems to indicate that unknowledgeable people
inhabit the PHP list, vice the PHP-DB list. Hmmmm.... <GRIN>
Third: what error do you get when you get the parsing error?
-----Original Message-----
From: Ron [mailto:allenr@fwd.areur.army.mil]
Sent: Friday, March 22, 2002 7:05 AM
To: php-db@lists.php.net
Subject: [PHP-DB] Forms
I know this is suppose to be databases, but the most knowledgeable people
seem to be in here.
This is the first time that I have tried to conquer a form in PHP(which I
obviously am not doing) so that I can have a total PHP script page and move
away from HTML.
Here is my code as followed by my book (PHP Black Book) some variables have
been changed
<?
$group[] = "Communications";
$group[] = "Network Section";
$group[] = "Wire Section";
$group[] = "Phones";
$question["section"] = array("type" => "radio",
"question" => "What section is this Trouble Ticket being opened for?",
"list" => $group);
function form($page, $question)
{
$text = "";
while(list($group, $v) = each($question))
{
if(strlen($text)) {$text .= "<BR>";}
$function = "form_" . $v["type"];
$text .= $function($name. $v);
}
return("<form action=\"ttsubmit.php" . $page . "\"
method=\"post\">"
. $text
. "<input type=\"submit\" name=\"submit\""
. " value=\"Submit\">"
. "</form>");
}
function form_radio($group, $parameters)
{
$output = "";
while(list($k, $v) = each($parameters["list"]))
{
if(strlen($output))
{
$output .= "<BR>";
}
$output .= "<input name=\"itsumit.php" . $group . "\"" . "
type=\"radio\""
. " value=\"" . $v . "\"";
if(isset($paramater["default"]) and $v == $paramater["default"])
{
$output .= " checked";
}
$output .= ">" . $v . "\n";
}
return($output);
}
//print(form ("tt.php", form_radio("group","parameters"));
When the last line is commented out there is no output at all. When I
uncomment the last line I get a parsing error.
I have been trying to figure this out, but I really lost here!
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php