[PHP] Question about the date
Hello, I have a question about the date. I have a script that compose an e-mail and send it. No problem until now, but I also need that the script can write the date of the next week. Let say we are Wednesday. The script must write the date of Wednesday 3rd in the e-mail. But from 5pm today, it needs to change it and write Wednesday 10th November. Same for every week. How to do that? Thank you very much for your help. Vous manquez despace pour stocker vos mails ? Yahoo! Mail vous offre GRATUITEMENT 100 Mo ! Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How does work shorten url services?
Hello, I know that some web sites offer a service to shorten long url. It is very useful when your site is hosted by your Internet provider for example, and that you have a long url. Or when you want to send it in an e-mail. tinyurl.com does that for example. The principle is that you enter your long url in their form and it gives you a shorten url like tinyurl.com/h4599 I was wondering how it works. I think it must use PHP. I see two possibilities. First is that the site creates an html page with a redirect header, like META HTTP-EQUIV=REFRESH CONTENT=0;URL=... But then it would mean that the site needs to host thousands of web pages for all its users. The second choice is to create a simple database with two fields. The first is the long url and the second is the shorten. So, when someone try tinyurl.com/h4599 it sends it to the real site. But is it possible for a web site to capture all the possible urls that it has created then compare it to its database? Because it has not created a webpage h4599.html for example, then the site should show a 404 page. Thanks for your help. Vous manquez despace pour stocker vos mails ? Yahoo! Mail vous offre GRATUITEMENT 100 Mo ! Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How does work shorten url services?
Hello, Those sites (because there are more) just put the urls in a database, and assign an ID to each one. Then, a program (that can be made in any language) queries the database for the given ID, and get the long URL. Then it redirects to that URL and that's all. Ok, it is like I thought, but if it is made in PHP is there a way to catch all the ID sent to the main page of tinyurl.com and then query the database? Like I said before, when someone type in its browser the url tinyurl.com/h4599 how tinyurl (or other similar services), are able to get the ID, what is the command? I hope I'm clear :-/ Vous manquez despace pour stocker vos mails ? Yahoo! Mail vous offre GRATUITEMENT 100 Mo ! Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to get a unique series of numbers?
Hello, I would take each number and place it in an array. Then for each Thank you very much. It has been really very helpful for me. Vous manquez despace pour stocker vos mails ? Yahoo! Mail vous offre GRATUITEMENT 100 Mo ! Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to get a unique series of numbers?
Hello, I want to generate a few numbers and those numbers must not be generated two times. For example the user chooses to have two series of 5 numbers. then I have to generate (with MT_RAND) two series of 5 numbers. No problem for the first, then the second must be different from the first. I have to test that the third is different from the second and from the first... If one of them is equal to a previous number then I have to generate a new number. Once the first series is finished I can move to the second. It will be the same instructions. I did it using an array like: while ($number[2]==$number[1]) {//Rand again number 2... It works even if it's not nice, as far as I know how many series I must generate. But if I don't know how many series the user will want, I can't write the same lines of code hundreds of times. How would you do? Thank you so much for sharing your knowledge with me. Vous manquez despace pour stocker vos mails ? Yahoo! Mail vous offre GRATUITEMENT 100 Mo ! Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Image and variable
Hello, I would like to use a variable instead of an image file name in a html page with this instruction: ?php echo 'img src=$myimage'; ? I tried but the image doesn't show up. Is it impossible or do I do something wrong? My goal is to have a random image print in the page, that's why I want to use a variable. Thank you for your good advices. Vous manquez despace pour stocker vos mails ? Yahoo! Mail vous offre GRATUITEMENT 100 Mo ! Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Image and variable
Hello, Variables in single-quoted strings are not evaluated. Either user double quotes or concatination: Thank you very much all for your help, specially Kevin Waterson for his complete program. It was simple, I always make some mistakes with those quotes :-( Another problem still related to those images. I have done that just as a test. Its' very simple but I really don't know why, the result is always the same picture. ?php $random=MT_RAND(1,2); echo $randombr; if ($random=1) { $image='pic.gif'; } if ($random=2) { $image='pic2.gif'; } echo $image; echo img src='$image'; ? Before I used 'if... else' but it wasn't working so I made a test with a second 'if'. I print the result of the variable to be sure that the number is really different, but anyway the picture is always the same. Why, why, why? Vous manquez despace pour stocker vos mails ? Yahoo! Mail vous offre GRATUITEMENT 100 Mo ! Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Another problem with grids and checkboxes
Hello, td style=vertical-align: top;1input name=grid[1][1] value=1 type=checkboxbr /td [snip] td style=vertical-align: top;1input name=grid[2][1] value=1 type=checkboxbr /td Is there a reason you're sending a 1, 2 or 3 value with the checkboxes? Well, I thought it was the good way to do. It helps me to know which box has been checked (?). Yes, because You already know what was checked by the keys of the $grid array. I'd Yes, ok. td style=vertical-align: top;1input name=grid[1][1] value=1 type=checkbox?php if(isset($grid[1][1])){echo ' checked';}?br/td I let the value as it was because I would need to rename a few hundreds checkboxes :-/ but I had used your test in PHP if (isset($grid... and it works fine. In fact it was very simple. When I think the time I tried to find a solution. Shame on me. Ok, my excuse is that I'm just learning. Thank you very much. Vous manquez despace pour stocker vos mails ? Yahoo! Mail vous offre GRATUITEMENT 100 Mo ! Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Another problem with grids and checkboxes
Hello, I have another problem with my program. Again! Here it is: I have some grids. To make it simple, let's say I have two grids like this: td style=vertical-align: top;1input name=grid[1][1] value=1 type=checkboxbr /td td style=vertical-align: top;2input name=grid[1][2] value=2 type=checkboxbr /td /tr tr align=centertd style=vertical-align: top;3input name=grid[1][3] value=3 type=checkboxbr td style=vertical-align: top;1input name=grid[2][1] value=1 type=checkboxbr /td td style=vertical-align: top;2input name=grid[2][2] value=2 type=checkboxbr /td /tr tr align=centertd style=vertical-align: top;3input name=grid[2][3] value=3 type=checkboxbr Each grid has 3 numbers, 1, 2 and 3. There is grid[1][1], grid[1][2] and grid[1][3] There is also the second grid, grid[2][1], grid[2][2], grid[2][3] The checked boxes are in an array $grid. If the user doesn't check enough boxes, the program must print the form again with the first choices of this user. I made a function for this task: function was_selected($option) { GLOBAL $grid; for ($j=1;$j3;$j++) {//number of grids for ($k=1;$k4;$k++) {//number of boxes if (isset($grid[$j][$k])) { if ($grid[$j][$k]==$option) { return TRUE; Then my form is something like that: td style=vertical-align: top;1input name=grid[1][1] value=1 ?php if(was_selected(1))) {echo checked;}? type=checkboxbr So, normally, if the user chooses the box 1 from the first grid, the first box of the first grid should be checked when the browser prints the form again. But in fact, the first box of the second grid is also checked. The reason is certainly because the values are the same in all the grids. But I can't change them as it's to make a lottery with many grids. How can I solve this problem? Thank you so much for your help. Vous manquez despace pour stocker vos mails ? Yahoo! Mail vous offre GRATUITEMENT 100 Mo ! Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Replace a button by an image
Hello, Is it possible to replace a button by an image with PHP? Thanks! Dave Vous manquez despace pour stocker vos mails ? Yahoo! Mail vous offre GRATUITEMENT 100 Mo ! Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question about for
Hello, I woudlike to use a loop: for ($i=1;$i11;$i++) But instead of incrementing with 1, I would like to increment by 2. So $i would be 1,3,5,7,9. I tried to find the answer may be with step but couldn't find anything. Thank you for your help. Dave Vous manquez despace pour stocker vos mails ? Yahoo! Mail vous offre GRATUITEMENT 100 Mo ! Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem of a beginner with Array
Hello, Thank you very much for all the people who replied me so fast. Unfortunately I still have a problem with that part. Matt M. [EMAIL PROTECTED] wrote: Now, I want to know which numbers have been checked by the player. I have a : input name=Grid1 type=checkbox for the first grid. Grid2 for the grid #2... if the user checks any Grid1[] boxes then $_POST['Grid1'] will be an array and so on. I want to avoid to have to name each check box like this: Grid[1][1] //1st checkbox of the first grid Grid[1][2] //2nd checkbox of the first grid and so on I would prefer to have if possible: input name=Grid1[] typecheckbox //1st grid, 1st checkbox input name=Grid1[] typecheckbox //1st grid, 2nd checkbox... That's what Matt M proposed. If I do: echo $_POST['Grid1']; I have on as a result and not a value. I also tried with echo $_POST['Grid1[]']; and other similars but I have an error message undefined index, or array. Thanks again. Dave Créez gratuitement votre Yahoo! Mail avec 100 Mo de stockage ! Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ Yahoo! Messenger: dialoguez instantanément avec vos amis. Téléchargez GRATUITEMENT sur http://fr.messenger.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem of a beginner with Array
Hello Torsten, try this: input name=Grid1[1] typecheckbox file://1st grid, 1st checkbox input name=Grid1[2] typecheckbox file://1st grid, 2nd checkbox... Seems I can't do another way than this. Not possible to do just Grid1[]. After submit you will receive $_POST['Grid1'] as an ARRAY containing all indices of the checked checkboxes. Then loop through it and do what ever you want: foreach ($_POST['Grid1'] as $value) { echo $value; } So, I did it like you said but the result of echo $value is on not the checkedbox number. Regards. Dave Créez gratuitement votre Yahoo! Mail avec 100 Mo de stockage ! Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ Yahoo! Messenger: dialoguez instantanément avec vos amis. Téléchargez GRATUITEMENT sur http://fr.messenger.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem of a beginner with Array
Hello, I'm just starting with PHP and I have a problem. This is certainly very easy for you but for me, it's tough. I want to make a lottery site (just as an exercise), so I made a page with 6 grids of 50 numbers each (check boxes). Now, I want to know which numbers have been checked by the player. I have a : input name=Grid1 type=checkbox for the first grid. Grid2 for the grid #2... I was thinking to get the numbers chosen by the player with $_POST['Grid1[]'] Grid1 being a table but it doesn't work. I thought I wouldn't have to declare an array. I have 50 numbers for each grid, I don't want to have to type array followed by the 50 numbers. There is not a way to do something like array(1...50). What is the solution? Thank you very much (in advance) for your help. Dave - Créez gratuitement votre Yahoo! Mail avec 100 Mo de stockage ! Créez votre Yahoo! Mail Yahoo! Messenger : dialoguez instantanément avec vos amis - c'est gratuit !