form的传递问题,官方模板已经有个范例了,求解

rlangzi 2010-07-30 02:10:52
想在首页实现这个效果


而官方模板里首页已经有了这样的一个效果,但是只有标题,没有内容



官方模板的form代码为
  <form name="wordform" action="{$M[url]}question.php" method="post">
<input name="title" id="asktitle" type="text" class="qbox" value="请在此提交您的问题,医生将为您一一解答!" onfocus="this.value=''; this.style.color='#333333'" style="color: rgb(51, 51, 51); " />
<input type="submit" value="我要提问" class="btn_ask" />
<input type="button" value="搜索答案" name="search" onClick="search_submit();" class="btn_search" />
</form>


之后转到question.php,此页的效果为


标题已经传递到了question.php去了,但是内容不知道怎么样传递?

此页模板question.html的form代码为
<form name="myform" method="post" action="{$M[url]}question.php?" onSubmit="return checkform(this);">
<tr>
<th width="90">您的问题</th>
<td><input type="text" name="info[title]" id="title" value="{$title}" size="50"></td>
</tr>
<tr>
<th style="vertical-align:top">问题补充</th>
<td><textarea name="message" id="message" rows="9" cols="60" ></textarea>
{if $M[use_editor]}{form::editor('message','introduce','100%',200,0)}{/if}
</td>
</tr>
<tr>
<th style="vertical-align:top">问题分类</th>
<td>
<span id="load_catid"></span>
<input type="hidden" name="info[catid]" id="catid" value="">
<a href="javascript:category_reload();">重选</a>
<script type="text/javascript">
function category_load(id)
{
$.get('{$M[url]}load.php', { id: id },
function(data){
$('#load_catid').append(data);
});
}
function category_reload()
{
$('#load_catid').html('');
category_load(0);
}
category_load(0);
</script>
</td>
</tr>
<tr>
<th>悬赏积分</th>
<td><select name="info[reward]" id="reward" onchange="ckreward();">
<option value=0>0</option>
<option value=5>5</option>
<option value=10>10</option>
<option value=15>15</option>
<option value=20>20</option>
<option value=30>30</option>
<option value=45>45</option>
<option value=60>60</option>
<option value=80>80</option>
<option value=100>100</option>
</select>( 注:您目前的总积分为:{$_point} )
<span id="reward_msg"></span></td>
</tr>
<tr>
<th>匿名设定</th>
<td><input type="checkbox" id="anonymity" onclick="checkAnonymity();" name="info[anonymity]" value="1">您可以对问题设定匿名,但您需要付出积分{$M[anybody_score]}分。<span id="anonymity_msg"></span></td>
</tr>
{if $M[publish_code]}
<tr>
<th>验证码</th>
<td id="reg_code">{form::checkcode('checkcodestr',5)}
</td>
</tr>
{/if}
<tr>
<th></th>
<td><input type="hidden" name="forward" value="{$forward}"><input name="dosubmit" type="submit" value="好了,提交" /></td>
</tr>
</form>




我就想在首页有一个也可以填写内容并传递到问题提交页的效果,需要怎么写呢?

还是需要更改PHP?

...全文
110 点赞 收藏 7
写回复
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
rlangzi 2010-07-30
一定一定,以后一定努力学习,感谢rosean,很感谢。
回复
rosean 2010-07-30
看来你得好好学下了
回复
twxclove 2010-07-30
无能为力,阿门,幸福因为难题而痛苦
回复
rlangzi 2010-07-30
请教各位大哥,能指点一下吗?
回复
rlangzi 2010-07-30
请问具体怎么写呢?求教

question.php全文为
<?php 
require './include/common.inc.php';
if(!$_userid) showmessage($LANG['please_login'],$MODULE['member']['url'].'login.php?forward='.urlencode(URL));
require MOD_ROOT.'include/ask.class.php';
$ask = new ask();
if(!$forward) $forward = HTTP_REFERER;

switch($action)
{
case 'getcheckcode':
echo form::checkcode('checkcodestr',5);
break;
default:
if($dosubmit)
{
checkcode($checkcodestr, $M['publish_code']);
$info['catid'] = intval($info['catid']);
$info['reward'] = intval($info['reward']);
$info['title'] = htmlspecialchars($info['title']);
if($info['title'] == '') showmessage($LANG['title_no_allow_blank'],'goback');
if(!$info['catid']) showmessage($LANG['select_category'],'goback');
if($info['reward'] > $_point) showmessage($LANG['credit_is_poor'],'goback');
$posts['isask'] = 1;
foreach($info AS $key=>$val)
{
if(!in_array($key,array('title','catid','reward','anonymity'))) unset($info[$key]);
}
$posts['message'] = $M['use_editor'] ? filter_xss($message) : strip_tags($message);
$info['addtime'] = $posts['addtime'] = TIME;
$info['endtime'] = TIME+1296000;
$info['userid'] = $posts['userid'] = $_userid;
$info['username'] = $posts['username'] = $_username;

if($posts['anonymity'] && intval($M['anybody_score']+$info['reward'])>$_point)
{
$posts['anonymity'] = 0;
}
if(file_exists(CACHE_PATH.'cache_ask_update.php'))
{
$cache_ask_update = file_get_contents(CACHE_PATH.'cache_ask_update.php');
if(!empty($cache_ask_update) && $cache_ask_update < (TIME-intval($M['autoupdate'])))
{
require 'cache.func.php';
cache_common();
file_put_contents(CACHE_PATH.'cache_ask_update.php',TIME);
@chmod(CACHE_PATH.'cache_ask_update.php');
}
}
else
{
file_put_contents(CACHE_PATH.'cache_ask_update.php',TIME);
@chmod(CACHE_PATH.'cache_ask_update.php');
}
if($M['publish_check'])
{
$info['status'] = $posts['status'] = 1;
$id = $ask->add($info,$posts);
showmessage($LANG['waiting_check'],$forward);
}
else
{
$info['status'] = $posts['status'] = 3;
if($info['reward'] >= $M['height_score']) $info['flag'] = 2;
$id = $ask->add($info,$posts);
$url = ask_url($id);
showmessage($LANG['publish_success'],$url);
}
}
else
{
$title = stripslashes($title);
if($ask->check_status()>0) showmessage($LANG['please_solve_expired_ask'], $M['url']."center.php?action=ask&flag=-1");
$head['title'] = '我要提问';
include template('ask', 'question');
}
break;
}
?>

回复
jianglin28290 2010-07-30
需要修改question.php做出对message的处理
回复
发动态
发帖子
基础编程
创建于2007-09-28

2.1w+

社区成员

从PHP安装配置,PHP入门,PHP基础到PHP应用
申请成为版主
社区公告
暂无公告