|
|
|
| Ребят помогите с input type=radio я в users.php добавил пять radio и в файл save_users.php добавил обработку... но почему то вылетаю на Index.php. в чем ошибка понять не могу! помогите плз!,)
--
-- Структура таблицы `gl_users`
--
CREATE TABLE `gl_users` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(20) NOT NULL default '',
`age` varchar(20) NOT NULL default '',
`growth` varchar(45) NOT NULL default '',
`gbreast` varchar(45) NOT NULL default '',
`additionally` varchar(255) NOT NULL default '',
`picture` enum('1.jpg','2.jpg','3jpg','4.jpg','no') NOT NULL default 'no',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=27 ;
|
users.php:
<?php
echo "<form action=\"save_users.php\" method=\"post\">\r\n";
$get_users = @mysql_query("SELECT * FROM gl_users");
$count = 0;
while ($user = @mysql_fetch_array($get_users))
{
echo "ID: <input type=\"hidden\" name=\"id_$count\" value=\"$user[id]\"> $user[id]<br>
Имя<br><input type=\"text\" name=\"name_$count\" value=\"$user[name]\"><br>
Возраст<br><input type=\"text\" name=\"age_$count\" value=\"$user[age]\"><br>
Рост<br><input type=\"text\" name=\"growth_$count\" value=\"$user[growth]\"><br>
Размер груди<br><input type=\"text\" name=\"gbreast_$count\" value=\"$user[gbreast]\"><br>
<input type=\"radio\" name=\"favicon_$count\" value=\"1.jpg\">1
<input type=\"radio\" name=\"favicon_$count\" value=\"2.jpg\">2
<input type=\"radio\" name=\"favicon_$count\" value=\"3.jpg\">3
<input type=\"radio\" name=\"favicon_$count\" value=\"4.jpg\">4
<input type=\"radio\" name=\"favicon_$count\" value=\"no\">нет картинки
Дополнительная информация<br><input type=\"text\" name=\"additionally_$count\" value=\"$user[additionally]\"><br><hr>\r\n";
$count++;
}
echo "<input type=\"submit\" value=\"Изменить\"></form>\r\n";
?>
|
save_users.php :
<?php
$count = (int)count($_POST) / 3;
for ($i = 0; $i < $count; $i++)
{
$id = $_POST["id_" . $i];
$name = $_POST["name_" . $i];
$age = $_POST["age_" . $i];
$growth = $_POST["growth_" . $i];
$gbreast = $_POST["gbreast_" . $i];
$additionally = $_POST["additionally_" . $i];
$picture = $_POST["favicon_" . $i];
if (($picture != "1.jpg") && ($picture != "2.jpg") && ($picture != "3.jpg") && ($picture != "4.jpg") && ($picture != "no"))
{
echo "<HTML><HEAD>
<META HTTP-EQUIV='Refresh' CONTENT='0; URL=index.php'>
</HEAD></HTML>";
exit;
}
@mysql_query("UPDATE gl_users SET name='$name', age='$age', growth='$growth', gbreast='$gbreast', additionally='$additionally', picture='$picture' WHERE id=$id");
}
echo "Изменения внесены
<HTML><HEAD>
<META HTTP-EQUIV='Refresh' CONTENT='3; URL=users.php'>
</HEAD></HTML>";
?>
|
| |
|
|
|
|
|
|
|
для: t3ma
(19.03.2009 в 11:39)
| | что никто не знает ?.((( | |
|
|
|
|
|
|
|
для: t3ma
(19.03.2009 в 15:14)
| | Из-за этой проверки вас перекидывает на index.php
if (($picture != "1.jpg") && ($picture != "2.jpg") && ($picture != "3.jpg") && ($picture != "4.jpg") && ($picture != "no"))
{
echo "<HTML><HEAD>
<META HTTP-EQUIV='Refresh' CONTENT='0; URL=index.php'>
</HEAD></HTML>";
exit;
}
Видимо параметр $picture где-то теряется или неправильно передается!
Сделайте echo $picture, станет ясней! | |
|
|
|