Kyde gresha?
1 отговора
57 прегледа
Kyde gresha?
<html>
<head><title>Form Example</title></head>
<body>
<h1>Form Example</h1>
<?php
function show_form($first="",$last="",$interest=""){
$options=array('Sports','Busines','Travel','Shopping','Computers');
if(empty($interest)) $interest=array(-1);
?>
<form action="form.php" method="post">
First Name:
<input type=text name=first value="<?echo$first?>">
Last Name:
<input type=text name=last value="<?echo$last?>">
Interests:
<select multiple name=interest[]>
<?php
for($i=0, reset($interest);$i<count($options);$i++) {
echo "<OPTIONS";
if(curent($interest)==$options[$i]) {
echo "SELECTED";
next($interest);
}
echo">$options[$i]\n";
}
?>
</select>
<input type=submit>
</form>
<? }
if(!isset($first)) {
show_form();
}
else {
if(empty($first) || empty($last) || count($interest) == 0) {
echo "You did not fill in all the ";
echo " fields, please try again.<p>\n";
show_form($first,$last,$interest);
}
else {
echo "Thank you, $first $last, you ";
echo "selected".join(" and ",$interest);
echo "as your interests.<p>\n";
}
}
?>
</body></html>
<head><title>Form Example</title></head>
<body>
<h1>Form Example</h1>
<?php
function show_form($first="",$last="",$interest=""){
$options=array('Sports','Busines','Travel','Shopping','Computers');
if(empty($interest)) $interest=array(-1);
?>
<form action="form.php" method="post">
First Name:
<input type=text name=first value="<?echo$first?>">
Last Name:
<input type=text name=last value="<?echo$last?>">
Interests:
<select multiple name=interest[]>
<?php
for($i=0, reset($interest);$i<count($options);$i++) {
echo "<OPTIONS";
if(curent($interest)==$options[$i]) {
echo "SELECTED";
next($interest);
}
echo">$options[$i]\n";
}
?>
</select>
<input type=submit>
</form>
<? }
if(!isset($first)) {
show_form();
}
else {
if(empty($first) || empty($last) || count($interest) == 0) {
echo "You did not fill in all the ";
echo " fields, please try again.<p>\n";
show_form($first,$last,$interest);
}
else {
echo "Thank you, $first $last, you ";
echo "selected".join(" and ",$interest);
echo "as your interests.<p>\n";
}
}
?>
</body></html>
що поне не кажеш какъв е проблема ?
може да се окаже, че тва дето си пуснал си е наред...
[линк]
[линк]