try another color scheme:


Go Back   TECH6.0 > Get Techie > Programming > PHP/MySQL


Help with checkboxes and visual design

This is a discussion on Help with checkboxes and visual design within the PHP/MySQL section, part of the Programming category; Hi All I find I need some more help with something that should be very simple lol. I have a ...

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 25-02-2009, 10:46 PM
TaL's Avatar
TaL TaL is offline

Moderator
 
Name: Steve
Join Date: Dec 2008
Location: Canada
Posts: 75
TaL will become famous soon enoughTaL will become famous soon enough
Default Help with checkboxes and visual design

Hi All

I find I need some more help with something that should be very simple lol.

I have a database table called `ideas` that I use to store any old idea that pops into my head that I don't want to forget...basically a dynamic scratchpad that can only be accessed from my "admin" page. The security is handled by secure session variable registration and the only way to become an admin member is by manually updating the `registered_users` table to reflect `group`='admin'


The ideas table looks like this:
-The content field is of type text-

Code:
+--------+-------------+--------------+------------------------------------+
| sec_id | content | status     | TIMESTAMP                 |
+----------+-----------+--------------+------------------------------------+
|     62   | an idea |      1       | 2009-02-25 00:24:04  |
+----------+-----------+--------------+------------------------------------+

I have a text area that inserts the 'content' (which I mysql_real_escape_string before insertion) and I am able to display it back to the page with this:

PHP Code:
$sql="SELECT * FROM ideas"//define the sql query with the search paramiter
$result=mysql_query($sql); //store the result of the query
// If successfully queried
if($result)
//boolean check if result is true then it got at least 1 row therefore do the following
//get the row count of the ideas table
    //initialize the row count
    
$count=-1;
    
$count=mysql_num_rows($result);
    if(
$count>=1)
        
//if 1 or more instance of an idea was found in our database, retrieve the data from idea table
    
{
        for (
$i=0;$i<=$count;$i++)
        { 
            
$rows=mysql_fetch_array($result);
            
$ideaID=$rows['sec_id'];
            
$idea=$rows['content'];
            
$ideaStatus=$rows['status']; //set the variables for insertion to registered_users
            
$stamp=$rows['TIMESTAMP'];
            echo 
"$idea<br>Was added at: $stamp<br>";
        }
    }
    ELSE  
//else, the ideas table is empty
    
{
        echo 
"<br><b>Congratulations, you are caught up on your ideas!</b><br>";
    }
}
?> 
Now, what I would like to do is have 3 check boxes generated for each idea that is displayed
(thats why I have the status variable) that I can use to set the idea = done, edit the idea, or delete the idea entirely. I would also like to put each idea in a bordered area so they are visually separated.
I think for editing the content, I can pull it from the table, display it in a text area, make my changes, and save it back to the same content row where the sec_id's will match.

I also need to be able to handle the fact that puncuation (especially single quotes) can mess up my displaying of the ideas

I really have no experience working with checkboxes (and very little experience dealing with forms in general) and I thought I would see if the good people here can lend a hand and maybe some brain power too

I can provide more if anyone needs it. Thanks in advance.
__________________
Go placidly amid the noise and haste, and remember what peace there may be in silence

The Desiderada

Last edited by TaL; 26-02-2009 at 01:04 AM. Reason: fixed typeo
Reply With Quote
  #2  
Old 26-02-2009, 06:58 AM
webwizzy's Avatar

Administrator
 
Name: Vinayak
Join Date: Feb 2008
Location: India
Phone: Samsung Wave
Posts: 1,116
webwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nice
Send a message via Yahoo to webwizzy
Default

Now, what I would like to do is have 3 check boxes generated for each idea that is displayed
(thats why I have the status variable) that I can use to set the idea = done, edit the idea, or delete the idea entirely.
As Said by TaL
I am not able to understand why you need checkboxes for this? Shouldn't it be radio/option buttons instead?

I hope you are aware that checkboxes are used for multiple selection and radio buttons for a single selection.

So wouldn't it make more sense if you use radio buttons, so that the user can choose ONLY ONE OPTION OUT OF THE THREE AT A TIME. You would either be editing or deleting it, not doing both at once right?

I have an admin page for my site that I designed and is doing exactly what you want, however I'm not into any kind of buttons and all (as its solely for me), am just using simple text links to delete and edit.
__________________
Always TAG and SHARE your threads
Submit your site to TECH6 Directory
TECH6 on Facebook - Like Us

Would you like to Link To Us | Support TECH6 by going Premium
Know more about me at Vinayaks.com | Follow TECH6 at Twitter


Reply With Quote
  #3  
Old 26-02-2009, 07:09 AM
TaL's Avatar
TaL TaL is offline

Moderator
 
Name: Steve
Join Date: Dec 2008
Location: Canada
Posts: 75
TaL will become famous soon enoughTaL will become famous soon enough
Default

I guess it is my total lack of experience with forms that made me think I needed check boxes. Perhaps you can show me an example of doing this with radio selections if it is not too much trouble? I agree that this does not need to be anything great as it is just for me. Also, any good sites for learning about form manipulation would be helpful. I have found some but none that were really any good for me to learn from.
__________________
Go placidly amid the noise and haste, and remember what peace there may be in silence

The Desiderada

Last edited by TaL; 26-02-2009 at 07:10 AM. Reason: fixed typeo
Reply With Quote
  #4  
Old 27-02-2009, 12:10 AM
TaL's Avatar
TaL TaL is offline

Moderator
 
Name: Steve
Join Date: Dec 2008
Location: Canada
Posts: 75
TaL will become famous soon enoughTaL will become famous soon enough
Default

I think that you are right. Since this is just my page, I can do it with text links until I get more knowledge about using forms. Thanks for the advice
__________________
Go placidly amid the noise and haste, and remember what peace there may be in silence

The Desiderada
Reply With Quote
  #5  
Old 27-02-2009, 08:26 AM
webwizzy's Avatar

Administrator
 
Name: Vinayak
Join Date: Feb 2008
Location: India
Phone: Samsung Wave
Posts: 1,116
webwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nice
Send a message via Yahoo to webwizzy
Default

I think that you are right. Since this is just my page, I can do it with text links until I get more knowledge about using forms. Thanks for the advice
As Said by TaL View Post
Or if you want to, you can try this tutorial of using PHP with Radio buttons
http://www.homeandlearn.co.uk/php/php4p10.html
__________________
Always TAG and SHARE your threads
Submit your site to TECH6 Directory
TECH6 on Facebook - Like Us

Would you like to Link To Us | Support TECH6 by going Premium
Know more about me at Vinayaks.com | Follow TECH6 at Twitter


Reply With Quote
  #6  
Old 01-03-2009, 06:45 AM
TaL's Avatar
TaL TaL is offline

Moderator
 
Name: Steve
Join Date: Dec 2008
Location: Canada
Posts: 75
TaL will become famous soon enoughTaL will become famous soon enough
Default

Hey. When I decided to use the text link format, things fell right into place.

I definitional need more practice working with forms but the text links are great for what I needed now. I have also changed around my tech tips page (to use the same kind database power as the scratch pad) to control the content of that page with the input for it on my admin page.
It all has a very simple look but is very functional. I still have some issues to work out and I find I am not much of a front end designer but I find I can usually get what I need out of it and I am getting better and more confident with programming
__________________
Go placidly amid the noise and haste, and remember what peace there may be in silence

The Desiderada
Reply With Quote
Reply

Bookmarks


Thread Tools
Display Modes




All times are GMT +5.5. The time now is 01:37 AM.

Contact Us - Tech6.com - Link to Us - Advertise - Submit Site - Privacy Statement - TOS - Top