php rand() question

  • jamesbond
  • Novice
  • Novice
  • jamesbond
  • Posts: 23

Post 3+ Months Ago

i have a form asking a user for a number and i want a rand number generated that would be = to or less the users numbers. I know the rand(min,max) works but what if i want max to be a number chosen on a form ? how would i code that. I tried entering the variable like this rand(0,$variable) but that does not work.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Posts: 6252
  • Loc: Seattle, WA

Post 3+ Months Ago

*sigh*

You haven't given us any information to help you do what you want to do. What language are you working in? What code do you have so far? What exactly "does not work"?
  • jamesbond
  • Novice
  • Novice
  • jamesbond
  • Posts: 23

Post 3+ Months Ago

its php and i fixed it already. it was just a problem using rand(). it was a problem using a variable as max and the fix was a spelling error (i know i should know better but it was a long day)

ps. It says in my topic php rand() question
  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Posts: 6252
  • Loc: Seattle, WA

Post 3+ Months Ago

For future reference, simply having 'php' in your topic title doesn't provide any context. You could be running the PHP on page-load, via AJAX, etc. Without seeing code, we can't just guess the problem.

Glad you got it figured out.

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 65 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.