1 (edited by Tubby 2006-10-25 00:48)

Topic: Checkbox

well im currently creating a new checkbox in profile.php under display. What this checkbox is for is the display of my newsbox on my forum index.

So far i have created a new feild under the users table and named it "show_newsbox" and then i set it up in profile.php., but it seems that it doesnt stick to the default value nor switch to a different value when checked......in other words you cant check the box.....is there any suggestions for this?

This is the checkbox i stored in profile.php jsut after the show_img checkbox

<label><input type="checkbox" name="form[show_newsbox]" value="1"<?php if ($user['show_newsbox'] == '1') echo ' checked="checked"' ?> /><?php echo 'Show Newsbox'; ?><br /></label>

Here is the line that collects it from the database. Look for u.show_newsbox

$result = $db->query('SELECT u.id, u.username, u.email, u.title, u.realname, u.url, u.jabber, u.icq, u.msn, u.aim, u.yahoo, u.location, u.use_avatar, u.signature, u.disp_topics, u.disp_posts, u.email_setting, u.save_pass, u.notify_with_post, u.notify_mp, u.use_pm, u.popup_pm, u.show_smilies, u.show_img, u.show_newsbox,  u.show_img_sig, u.show_avatars, u.show_sig, u.timezone, u.style, u.num_posts, u.last_post, u.registered, u.registration_ip, u.admin_note, g.g_id, g.g_user_title, g.g_color FROM '.$db->prefix.'users AS u LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());

Re: Checkbox

Some of the info in the following topic and the topic linked to within it might help: http://punbb.org/forums/viewtopic.php?id=13590

Looking for a certain modification for your forum? Please take a look here before posting.

3

Re: Checkbox

ok i can now get the checkbox to stay checked but for some reason its not changing anything even if you save it...heres is my news.php file stored in my "users" folder. How could i modify this so that it refers to the checkbox in profile.php.....as you can see i have already given it an attempt. Im wondering if i have to call for anything in the database?

<?php
if ($pun_user['g_id'] < PUN_GUEST)
{
?>
<?
if ($user['show_newsbox'] != '1')
{
?>
<div class="block" style="margin-left: 8px; margin-right: 8px; margin-bottom: 8px; margin-top: 8px">
<h2><span><a href="viewforum.php?id=1">News and Updates</a></span></h2>
<div class="box" style="height: 145px; overflow: auto">
<div class="inbox">
<?php
include('http://www.fatalgamers.org/forums/extern.php?action=news&fid=1');
?>
</div>
</div>
</div>
<?
}
?>
<?
}
?>

4 (edited by Tubby 2006-10-26 20:06)

Re: Checkbox

bump

5

Re: Checkbox

anyone have any suggestions for me?

Re: Checkbox

Shouldn't you be using "$pun_user['show_newsbox'] != '1'" on your news.php?

Looking for a certain modification for your forum? Please take a look here before posting.

7 (edited by Tubby 2006-10-26 23:50)

Re: Checkbox

thanks alot pogenwurst......iam always missing the smallest modifications for some reason tongue