Jump to content

adding a checkbox field to user profile in PHPFOX


websiteguy

Recommended Posts

I am setting up a PHPFOX v1.6 site for local musicians. Currently the member's profile set-up page is made up of several dropdown fields and some textareas.

 

My question is:

Is it a major re-write to add checkbox fields or convert a dropdown to a checkbox? I would assume there would be a lot of changes to the database also?

 

Link to comment
Share on other sites

I can't use radio buttons because the client wants a maximum of 4 choices (instruments played), so it would need multiple choices as in checkboxes.

 

The client feels dropdowns are too confusing for the average computer user (having to hold the control key), so this is his reasoning behind wanting to convert to checkboxes.

 

I know html very well, but am still a novice with php.

Link to comment
Share on other sites

can it be as simple as changing the name of the field in the script?

 

I've done considerable serching on this and haven't found anything specific telling me how.

 

I would show you the code, but it's pretty involved as I'm sure you can guess.

 

Link to comment
Share on other sites

If you are using php and dont want to change the tables of the database while using check boxes, then after the forum is submitted you could have it smash the data together with commas.  You would still be able to search the data, but it would take a little more work.

 

So if the user selects tuba, banjo, and harmonica, they would have to be in in an array, so that when it is submitted if position 1 has a value of 1 then "tuba," is inserted in the string then if position 3 has a value of 1 then "banjo," is inserted and so on so that the string ends up looking like "tuba,banjo,harmonica," and if you do the coding right you can get rid of the final comma, but it doesnt hurt for it to be there.

 

~D

Link to comment
Share on other sites

When you said:

dropdowns are too confusing for the average computer user (having to hold the control key)

did you mean that you can select multiple options from the select box? If so then it should be simple to rewrite, otherwise refer to 'Reply #8' by Daleeburg, considering what Revraz say's in 'Reply #9'

Link to comment
Share on other sites

Thanks for the replies!

As you can probably guess, the coding is over my head and sounds more extensive than I had hoped.

 

I might try to convince him that a set of simple instructions for the user on how to use control click would be much simpler.

 

Link to comment
Share on other sites

No, we were under the impression you only wanted 4 options, so he was saying show all 4 options in the option list so they can get a feel that they can select more than one.

 

So you want to list a bunch of options but only let them pick 4 of say 20?  If so, that's a bit tougher to do if you want it dynamic, as in, if they pick more than 4 without hitting submit, it would say only pick 4.  You can have instructions to say only pick 4 using just PHP, but you won't be able to check if more than 4 was picked until you submitted it, then you would reply back with an error saying to only pick 4.

Link to comment
Share on other sites

If you want it dynamic, then you would need to use Java.

 

If you want it to check after you hit submit, then you would have to add some error checking and if > 4 then error out and tell the user to only pick 4, and re-display the page.

Link to comment
Share on other sites

I did understand that there were problems involved with checkboxes when some are not checked from the reading I've done.

 

I think a simple set of instructions to the user for control click on a dropdown field will still be much simpler.

 

I really appreciate all the help so far though.

 

Link to comment
Share on other sites

It would be, but if there is a "requirement" to only allow 4, you need to do some sort of check on how many options they picked.

 

I did understand that there were problems involved with checkboxes when some are not checked from the reading I've done.

 

I think a simple set of instructions to the user for control click on a dropdown field will still be much simpler.

 

I really appreciate all the help so far though.

 

Link to comment
Share on other sites

If there are 10 choices, but only 4 allowed, you would definitely need a Javascript function to call an alert if a 5th selection was attempted. In pure PHP, you would have to process the script each time, and re-present the script if there were > 4 selections; not nearly the most elegant of solutions. This really isn't a problem unless the code is over your head. In that situation, you would do your client a big favor by outsourcing that tiny part of the form. You might also present this problem to the Javascript board where you might find someone to get this working for you for cheap or even free.

 

PhREEEk

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.