Re: RTFM

From: Date: Sat, 19 Jan 2002 17:56:03 +0000
Subject: Re: RTFM
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-81233@lists.php.net to get a copy of this message
I've been (sorta) following this thread for the last little while and I have to say that I'm on the side of "one list for all!". The problem with splitting the list is the different levels of "newbie-ism" on different subjects, There are things that advanced users can learn from new comers to the language too. For instance. I don't really consider myself a "total newb" when it comes to PHP anymore, but there are areas of the language that I still haven't touched upon, which would make me a newbie. I agree though that some questions are asked a little too often, and that could be due to unclear documentation. If it is bothersome to you, write a nice simple tutorial and post it! For example, quite often I see people ask how to INSERT multiple values from one selectbox. I have yet to see anybody post any help save for telling people to use checkboxes instead. Using a selectbox for this isn't all that difficult at all! <mini tutorial> //FIRST YOU START WITH A SELECTBOX <select name="selectpackage[]" multiple> //NOTE THE "[]" AT THE END OF THE NAME FOR THE SELECTBOX, ONCE SUBMITTED THIS WILL BE TREATED AS AN ARRAY CONTAINING THE SELECTED VALUES. //THE "MULTIPLE" STATEMENT ALLOWS THE USER TO SELECT MULTIPLE OPTIONS INSTEAD OF JUST ONE. <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> </select> /////////////////// AFTER THE FORM IS SUBMITTED /////////////////// //GET A COUNT ON THE NUMBER OF ENTRIES SELECTED
       $mycount = count($selectpackage);
//USE THE RESULT FOR A COUNTER
       while($mycount){
           $mycount--;
//RUN YOUR INSERT COMMAND UNTIL THE COUNTER HAS EXPIRED
           mysql_query("INSERT INTO mytable (myvalue1,myvalue2) VALUES ('$selectpackage[$mycount]', '$mycount')");
       }
</mini tutorial> Maybe some of use should get together and start putting things like this in a repository with an easy flexible search. I know from experience that some of the documentation that is available to new users is a bit on the stuffy side. Sometimes a better approach is to give up some "starter code" and let them go from there. Just my two cents worth and a mini tutorial that can be used to get things started. Now if you'll excuse me, I have to continue banging my forehead on my keyboard figuring out this "%$#%$#@" file upload. (C: We all benefit from "new and used" users alike. ~Curt~

« previous php.general (#81233) next »