one question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jrts
Forum Newbie
Posts: 5
Joined: Sat Mar 01, 2003 11:27 am

one question

Post by jrts »

Hello,

I would like to know:
how can I define a variable so its value is higher than 1000 and lower
than 2000
2000 >variable >1000
and which sentence must a "select" have, so that it is able to search
between the values of a column.

Thank you very much for your help.

Best regards,

JoanR
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

If I got the point with "2000 >variable >1000 "

Code: Select all

$variable = rand(1001, 1999); // after a srand(...) somewhere
http://www.php.net/manual/de/function.rand.php
so that it is able to search between the values of a column
what search on what column?
jrts
Forum Newbie
Posts: 5
Joined: Sat Mar 01, 2003 11:27 am

Post by jrts »

thanks for your fast reply
this variable is for use in a html form, the form have a list/menu with different values and each value is between two numbers.

sorry but I don't write english very well

thx
User avatar
daven
Forum Contributor
Posts: 332
Joined: Tue Dec 17, 2002 1:29 pm
Location: Gaithersburg, MD
Contact:

Post by daven »

If you have any code written, post it here so we can look at it.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

uh, I have a horrible vision of beeing on a page with <select>-elements each having a thousand options ;)

Code: Select all

<html><body>
<form method="GET"  action="<?php echo $_SERVER['PHP_SELF']; ?>" >
	<select>
<?php
for ($i=1001; $i!=2000; $i++)
	echo '<option>', $i, '</option>';
?>
	</select>
</body></html>
If it is this you intend to do I beg you to consider at least using something like

Code: Select all

<html><body>
<form method="GET" action="<?php echo $_SERVER['PHP_SELF']; ?>" >
	<select name="upper">
<?php
for ($i=10; $i!=20; $i++)
	echo '<option>', $i, '</option>';
?>
	</select>
	<select name="lower">
<?php
for ($i=1; $i!=100; $i++)
	echo '<option>', ($i<10)? '0'.$i:$i, '</option>';
?>
	</select>
</form>
</body></html>
or to let the user enter the value in an <input>-element. You have to check the value server-side anyway.
JPlush76
Forum Regular
Posts: 819
Joined: Thu Aug 01, 2002 5:42 pm
Location: Los Angeles, CA
Contact:

Post by JPlush76 »

volka you should start charging for code writing services :)
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

I already do :D
But not here. Take the example codes as my deep regret for what I sell!
Or take it from this point of view: If I can avoid e.g. a site with thousand <option>-entries... a site I might vist... woohoo ;)
JPlush76
Forum Regular
Posts: 819
Joined: Thu Aug 01, 2002 5:42 pm
Location: Los Angeles, CA
Contact:

Post by JPlush76 »

lol :lol:
Post Reply