Forum Moderators: coopster
here is the code for the html
[edit: code snipped to show only form fields]
<form action="{S_CONFIG_ACTION}" method="post">
<input type="hidden" name="forum" value="{FORUM_ID}" />
<select size="1" name="topic_control">
<option value="1">ON</option>
<option value="2">OFF</option>
</select>
<input class="field" type="text" size="25" name="topic_message" value="{FORUM_TOPIC_MESSAGE}" />
<input type="submit" value="{L_UPDATE}">
</form>
========================================
here is the code from php
[edit: error checking snipped]
if( isset($HTTP_GET_VARS['topic_message']) ¦¦ isset($HTTP_POST_VARS['topic_message']) )
{
$topic_message = ( isset($HTTP_POST_VARS['forum']) )
? intval($HTTP_POST_VARS['topic_message'])
: intval($HTTP_GET_VARS['topic_message']);
}
else
{
$topic_message = '';
}
$sql = "UPDATE " . FORUMS_TABLE . "
SET topic_control = '$topic_control' , topic_controlmsg = " . intval($HTTP_POST_VARS[topic_message]) . "
WHERE forum_id = '$forum_id'";
if (!($db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error updating forum control', '', __LINE__, __FILE__, $sql);
}
can u guys please tell me what is wrong so that i can fix it ... i would really appreciate it .. y will the field only save numerical formats and y not text ..
[edited by: ergophobe at 9:13 pm (utc) on Oct. 4, 2004]
[edit reason] Code dump snipped - see forum charter [/edit]
$topic_message = ( isset($HTTP_POST_VARS['forum']) )
? intval($HTTP_POST_VARS['topic_message'])
: intval($HTTP_GET_VARS['topic_message']);
You are converting your text to integer.
For example, this script
$str = "This is a string to be converted to integer";
echo "The integer value of the string <i>$str</i> is: " . intval($str);
Creates this output
The integer value of the string This is a string to be converted to integer is: 0
Tom