7 Replies - 647 Views - Last Post: 09 August 2012 - 01:31 PM Rate Topic: -----

#1 rumbitas  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 98
  • Joined: 07-December 10

[QUESTION] How to make a list of selectable numbers?

Posted 08 August 2012 - 08:20 AM

Hi. How can I make a list of selectable numbers.

like:

[1][2][3]...[n]

And I can go clicking with the mouse on the numbers that I want to select. I do not know if I explain. It can be done in PHP?

Thanks

This post has been edited by rumbitas: 08 August 2012 - 08:21 AM

Is This A Good Question/Topic? 0
  • +

Replies To: [QUESTION] How to make a list of selectable numbers?

#2 KingCuddles  Icon User is offline

  • D.I.C Regular

Reputation: 176
  • View blog
  • Posts: 496
  • Joined: 20-December 08

Re: [QUESTION] How to make a list of selectable numbers?

Posted 08 August 2012 - 08:40 AM

So you want PHP to echo out a bunch of numbered boxes that you can select? Should be pretty easy with a loop..

Edit: Quick and dirty example from php.net:

$i = 1;
$max = 50;

while ($i <= $max) {
  //do something with $i here
  echo $i++;
}



Member CTphpnwb has posted a nice guide but it all depends on exactly what you are looking to do :).

You have confirmed further down that you are looking to work with checkboxes, Tizag has a basic demo of the checkbox syntax here.

There is a semi-relevent thread about checking if a checkbox has been checked in PHP here which may be useful in the future.

This post has been edited by KingCuddles: 09 August 2012 - 08:29 AM

Was This Post Helpful? 1
  • +
  • -

#3 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3039
  • View blog
  • Posts: 10,616
  • Joined: 08-August 08

Re: [QUESTION] How to make a list of selectable numbers?

Posted 08 August 2012 - 08:43 AM

Study this tutorial:
http://www.dreaminco...ment-using-dom/
Was This Post Helpful? 0
  • +
  • -

#4 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6081
  • View blog
  • Posts: 23,557
  • Joined: 23-August 08

Re: [QUESTION] How to make a list of selectable numbers?

Posted 08 August 2012 - 09:06 AM

Except that it looks like the OP wants a clickable list -- like a list of page numbers -- rather than a select, which would make KingCuddles suggestion more appropriate (with the addition of the HTML to make each number a link, but we'll leave that up to the OP...you do KNOW how make a link in HTML, right rumbitas?)
Was This Post Helpful? 0
  • +
  • -

#5 rumbitas  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 98
  • Joined: 07-December 10

Re: [QUESTION] How to make a list of selectable numbers?

Posted 08 August 2012 - 09:11 AM

Thanks for your help. I was thinking of selectable numbers, like a checkbox. If click-to 1, 1 remains selected, if click-in 1 again, 1 is deselected. That is my idea.
Was This Post Helpful? 0
  • +
  • -

#6 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6081
  • View blog
  • Posts: 23,557
  • Joined: 23-August 08

Re: [QUESTION] How to make a list of selectable numbers?

Posted 08 August 2012 - 09:12 AM

OK, so see where KingCuddles put this in the code?

//do something with $i here


What do you think you might put in the code there to generate a checkbox in HTML?
Was This Post Helpful? 0
  • +
  • -

#7 KingCuddles  Icon User is offline

  • D.I.C Regular

Reputation: 176
  • View blog
  • Posts: 496
  • Joined: 20-December 08

Re: [QUESTION] How to make a list of selectable numbers?

Posted 09 August 2012 - 08:30 AM

I have updated my first post with links to the basic checkbox syntax and a thread on DIC which illustrates how to check if a checkbox has been selected or not.
Was This Post Helpful? 0
  • +
  • -

#8 rumbitas  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 98
  • Joined: 07-December 10

Re: [QUESTION] How to make a list of selectable numbers?

Posted 09 August 2012 - 01:31 PM

Hello, sorry for the delay. I had a long day. I will check the links as soon as possible.

Thanks for your help. I will write again if I don't get good results.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1