|
|
|
| К поднимавшемуся уже вопросу не желания записываться в базу обьёмных данных формы.
http://softtime.ru/forum/read.php?id_forum=1&id_theme=1433&page=1
файл index.php
<?
session_start();
require('../lib/setup.php');
$smarty = new Smarty_Library;
?>
<html>
<body>
<?
if (!isset($_SESSION['user_id']))
{
?>
<form action="auto.php" method=post>
<input type="text" name="user_id"><br>
<input type="password" name="user_pass"><br>
<input type="submit" value="submit">
</form>
<?
exit;
}
else
{
?>
<h4 align=center> work with site(<?echo $new->author('nick',$_SESSION['user_id']);?>)</h4>
<?
if ($_SESSION['access']>=4)
{
echo "<a href=index.php?task=addnew> add new</a>";
echo "<a href=index.php?task=editnew> | edit new </a>";
}
if ($_SESSION['access']>=7)
{
echo "<a href=index.php?task=rednew> | rednew</a>";
}
if (isset($task)) include('php_modules/_'.$task.'.php');
}
?>
</body>
</html>
|
файл _addnew.php
<script>
function add(str)
{
document.all.depart.value=str;
}
</script>
<?
session_start();
$new=new news;
$error="";
if (isset($header))
{
if (empty($header)) $error.=" input header<br>";
if (empty($text)) $error.="input text <br>"
if (empty($source)) $error="input source <br>";
if (empty($depart)) $error="input depart <br>";
if (!empty($error))
{
echo $error;
exit;
}
$new->header=$header;
$new->body=$text;
$new->source=$source;
$new->depart=$depart;
$new->type=2;
$new->get("add_new",$_SESSION['user_id']);
}
$DEPARTS=$new->author_departs($_SESSION['user_id']);
$smarty->assign('DEPARTS',$DEPARTS);
$smarty->assign('author',$new->author('nick',$_SESSION['user_id']));
$smarty->display('addnew.tpl');
?>
|
шаблон addnew.tpl
<table width=100% height=100% border=1>
<tr>
<td width=50% valign=top align=center>
<form action="index.php" method="post">
<input type="hidden" name="task" value="addnew">
<input type="text" name="header" size="66" maxlength="100"><br>
<textarea name="text" cols="50" rows="25"></textarea><br>
source<input type="text" name="source" size="30" maxlength="50">
depart <input type="text" name="depart" size="9" maxlength="5"><br><br>
<div align=center><input type="submit" value="submit"></div>
</form>
</td>
<td width=25% valign=top>
<h5 align=center>news departs</h5>
<table>
{section name=id loop=$DEPARTS start=0}
<tr>
<td>
<div id=dep onclick=javascript:add({$DEPARTS[id].id})>{$DEPARTS[id].name}</div>
</td>
</tr>
{/section}
</table>
</td>
</body>
</html>
|
два дня уже мучаюсь.
помогите плиз. | |
|
|
|
|
|
|
|
для: Axxil
(10.01.2005 в 23:52)
| | Вот так работать не будет - session_start() следует вызывать до вывода любого текста в окно браузера...
<script>
function add(str)
{
document.all.depart.value=str;
}
</script>
<?
session_start();
|
| |
|
|
|
|
|
|
|
для: cheops
(11.01.2005 в 00:16)
| | исправил, всё равно не работает.
Мистика, блин... | |
|
|
|