Jump to content

Recommended Posts

I would like to create:

 

A simple form that, when entered, your answer would be added to a list of many others (perhaps in a table). For example, I would enter: "Animal Collective - The Feels" and it would add to a list of many other music suggestions upon submitting.

 

I know how to do this, but the bigger goal that I do not know how to do is this: I would like the answers randomized with each browser refresh. My reasoning for this is to eliminate the need for people to post "First! Woot woot! Yesssssssssssss..." then get on with their actual help. One's answer is not the most important. It is the collection of music suggestions that is.

 

Ideally, I would like to not use a forum, but have a simple form followed by a table of text once submitted so that you can view the other randomized answers. Hopefully, their suggestion would be lost in the mix already so they can view other's music suggestions.

 

Thanks so much for the help.

 

eristic

Link to comment
https://forums.phpfreaks.com/topic/105105-randomized-form-answers/
Share on other sites

Ok, so you've got a table full of music suggestions and you'd like to randomize the suggestions shown on each refresh.

 

You can use the rand() cmd in your sql query...such as:

 

select suggestions from music

order by rand()

limit 10

 

if your just randomizing the Entire list of suggestions, get rid of the limit in your query

Excuse my ignorance, but I have no idea if that is what I want. While I know how to make and view .php files, the computer I am on will not let me save them correctly (silly girlfriend computer!). I assume it is since both of you submitted the same php but I have no way of viewing it right now.

 

Thank you for your quick help.

 

eristic

You might want to use two text boxes - one for artist, the other for song.  So often you find people don't standardize what they write, and with a more obscure artist, it is difficult to tell which is the artist and which is the song!  For example, you might get something like: Stomp - Elephant.  Is the artist Stomp or Elephant?

 

Of course, if you did this, you would have two fields in your database, and call the two together, e.g.:

 

echo $row["artist"] . " " . $row["title"];

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.