Jump to content

litebearer

Members
  • Posts

    2,356
  • Joined

  • Last visited

Everything posted by litebearer

  1. 6 of one, 1/2 dozen of the other. In your popup window you have 300 to scroll thru; why not the same in the select? They are basically tthe same BUT the select offers: easier, quicker and less prone to human error. just my opinion though. Lite...
  2. Do it the simple way. Just create a 'select' in your form.
  3. Yes, there is.... [code]<?PHP $var00 = "0lil alx9d1, BagFullOfRic, YOURMOM, fdndfnfd , fdndfnfd , fdndfnfd, fdndfnfd, fdndfnfd, fdndfnfd, sleeperpick10, BagFullOfRice,BagFullOfRice74, iix3JAD0REuU, iix3JAD0REuU, sinwillsin, sportzr4me18, sleeperpick10, BaSkEtBaLLQT8674, xpjisuuus,BagFullOfShyt, %n, %n, BagFullOfRice, Patelk0014, Patelk0014, BagFullOfRice, BagFullOfRice, , Patelk0014, flirtyazngrl09, bigshot9214, bigshot9214, bigshot9214, mnkmnkz16, bleausky22312, , , fashnFrEEk92, BagFullOfRice, BagFullOfRice, , xbsbdfbdbfdbfd, xbsbdfbdbfdbfd, BagFullOfRice, BagFullOfRice, BagFullOfRice, BagFullOfRice, BagFullOfRice, BagFullOfRice, BagFullOfRice, BagFullOfRice, BagFullOfRice, BagFullOfRice, BagFullOfRice, BagFullOfRice, BagFullOfRice, BagFullOfRice, BagFullOfRice, BagFullOfRice, , BagFullOfRice, %n, BagFullOfRice, %n, %n, , BagFullOfRice, BagFullOfRice, BagFullOfRice, BagFullOfRice, BagFullOfRice, BagFullOfRice, %n, BagFullOfRice, BagFullOfRice, %n, BagFullOfRice, %n, BagFullOfRice, %n, BagFullOfShyt, BagFullOfShyt, BagFullOfShyt, rubberducky9314, rubberducky9314, rubberducky9314, %n, %n, BagFullOfRice, BagFullOfRice, BagFullOfRice, %n, Patelk0014, rubberducky9314, bigshot9214, bigshot9214, %n, BagFullOfRice, BagFullOfRice, BagFullOfRice, BagFullOfRice, BagFullOfRice"; ########### # convert the variable to an array $var02 = explode(",",$var00); ?> <pre> <?PHP print_r(array_count_values($var02)); ?> </pre> <?PHP ?>[/code] note that due to spaces in your variable it will appear that some of the elements are duplicated. to resolve this remove all spaces from the variable BEFORE you convert it to an array Lite...
  4. [a href=\"http://familyinternet.about.com/cs/computinghelp/l/aa052401a.htm\" target=\"_blank\"]http://familyinternet.about.com/cs/computi...l/aa052401a.htm[/a] Lite...
  5. Thank you. The personal page is really just that. As to what I use. Most of my stuff is simple html. depending upon what my goal is, I have used php and mysql. I do all my own graphics using Corel PhotoPaint. The secret to solving any problem is to define the correct questions. It is amzing how much you will discover all by yourself when you ask the right question. Also build slowly, one does not learn calculus before having a good handle on algebra, geometry and trig. Do NOT be afraid to make mistakes or fail. Use those times as the BEST teachers you will ever have. Lite...
  6. Try this.. [code]<?PHP $my_timestamp = time(); echo date("m d, Y", $my_timestamp); ?>[/code] then read here [a href=\"http://us3.php.net/date\" target=\"_blank\"]http://us3.php.net/date[/a] Lite...
  7. Ok. now its time for the old dog to tender his prespective... My background is finance with a heavy emphasis on crisis management consulting. In variablly most small businesses do not fail from undercapitization nor from a poor/product service. Rather, as the business begins to grow, the founder finds it difficult if not impossible to do some critical things. 1. [b]Learn to delegate[/b]. There is an old saying "many hands make light work." Look at an operating room. The surgeon is usually a gifted, highly intelligent, well trained AND experienced practioner of his/her craft. From the standpoint of 'knowledge' (read book learning) there are few who could compare. Never-the-less, except under highly unusual circumstances, there is a TEAM in that room. Each member of that team doing only a small portion of the task to be completed. To think that one can 'do it all' is setting oneself up for certain failure. Pride and ego are deadly. 2. [b]Accept the fact that your product/service will NEVER be perfect[/b]. Every artist, musician, author, accountant, graphics designer etc etc knows where the flaws in their creation lie. There is always the point where you have to ask yourself "Have I given my client/customer/boss the best I can do at this time? AND, Is what they are receiving MORE than what they thought they would get?" If you can answer yes, then you have accomplished your task and fulfilled your duties and obligations. 3. [b]Sit quietly and observe[/b]. See what sucessful businesses/people that you admire and respect do. ALSO see what businesses/people who fail do. Without meaning to be harsh, I have observed that the people who seem NOT to grasp the concepts which they are trying to learn, are the ones who do NOT experiment. I would venture to say that perhaps 1/2 of the questions asked on this and other similar forums, would be automatically answered/resolved had the questioner taken the time to experiment. As almost everyone has said here, your determination and dedication are admirable. But it is time for you to set some reasonable goals. Keep asking questions, but I would suggest spending most of your time readin other people's questions and experimenting to solve them. It is NOT the tool that defines the master that defines the tool. Good Luck Lite... - 60 years old, totally self taught in dbase, php, mysql, graphics, html and cooking ;)
  8. try this [code]function write_beg($filename, $data){     //Imports old data     $handle = f open($filename, "r");     $old_content = f read($handle, filesize ($filename));     f close($handle);     //Sets up new data     $final_content = $data.$old_content;     //Writes new data     $handle2 = f open($filename, "w");     $finalwrite = f write($handle2, $final_content);     f close($handle2); } [/code] everywhere there is a f with a space after it, remove the space. Lite...
  9. Just a crazy thought.... [code]<?PHP $old_array[] = "a"; $old_array[] = "c"; $old_array[] = "b"; $old_array[] = "d"; $count = count($old_array); $i2= $count-1; $i = 0; for ($i=0;$i<$count;$i++) {   $new_array[$i] = $old_array[$i2];   $i2=$i2-1; } $i=0; for ($i=0;$i<$count;$i++) {   echo $i . " = " . $new_array[$i] . "<br>"; } ?>[/code] Lite...
  10. Just a thought... [code]<?PHP ##################################################### #    presume $order is a multidimensional array. each element #    is itself an array containing qty, name, size # #    in practice you will get your arrrays from your database $order[0] = array(1,"Windmill Shirt","Small"); $order[1] = array(2,"Robot Shirt","Small"); $order[2] = array(2,"Goat Shirt","Small"); #################################################### #    count the number of elements in the array $order $item_count = count($order); #################################################### #    loop thru the array displaying all of the elements of the 'inner' arrays #    although example has pre-knowledge of the number of #    elements in the 'inner' arrays, you could rewrite the script #    to add cells as needed $i = 0; ?> <table border=1>    <tr><td>Qty</td><td>Name</td><td>Size</td></tr> <?PHP for ($i=0;$i<$item_count;$i++) {   ?>    <tr><td><?PHP echo $order[$i][0]; ?> </td><td><?PHP echo $order[$i][1]; ?> </td><td><?PHP echo $order[$i][2]; ?> </td></tr>   <?PHP } ?> </table> <?PHP ?>[/code]
  11. litebearer

    Hi

    Ok... Just a bit of the thought process. 1. Registration page for potential voters - user name - password - email address check to see that email address does not already exist in your voter database. if checks ok email to voter a link to the Ballot sign in page 2. Check that user has not already cast ballots 3. present ballot page - process vote 4. thank voter and present updated vote tallies See what you can do with that, as you begin to write your code, come back for more help. Lite...
  12. You could include this script. (NOTE: the board does NOT like f open, f read etc. SO where ever you see those in this script I had to put a space between the f and the rest. To use the code you will need to remove the spaces.) Its uses a small text file with the 3 character month in it. If the month in the file and the current month are the same, then the script knows NOT to delete the pictures; if, however, they are NOT the same, then it deletes all the pictures in the appropriate folder. You will need to make sure that the clearpics.txt file is chmod 777. Also you need to change the image directory to yours. Finally, you can change/add/delete file type to be deleted. Hope it is of some help. the clearpics.txt file (example) [code] Apr [/code] the main script [code]<?php function clear_pics(){     ###############################################     # change this to the name of YOUR image folder     $what_folder = 'images/'; // the directory, where your images are stored     ################################################     # this lists the type of files to be deleted     $valid_files = array('png','jpg','jpeg','gif');     $this_folder = opendir($what_folder);     while($image_name = readdir($$this_folder)) {         if(in_array(strtolower(substr($image_name,-3)),$valid_files)) {         $full_name = $what_folder . $image_name;         unlink($full_name);         }     } } ################################## # this is the file we use to check if the # files need deleting $filename = 'clearpics.txt'; ################################## # this is the current month $month = date("M"); ################################ # check to see if the file exists if (!file_exists($filename)) {     touch($filename);     $fp = f open($filename, "w");     $string = $month;     $write = f puts($fp, $string);     f close($fp); } ################################# # open the file and get the contents $fp = f open($filename, "r"); $contents = trim(f read($fp, filesize($filename))); f close($fp); ########################################## # if the current month and the month stored #        are not the same then #        delete the files and write the current #        month to our txt file if ($month != $contents) {     clear_pics();     $fp = f open($filename, "w");     $string = $month;     $write = f puts($fp, $string);     f close($fp); } ?> [/code] Lite...
  13. Have a look at this tutorial. [a href=\"http://www.createafreewebsite.net/phpmysql/insert.html\" target=\"_blank\"]http://www.createafreewebsite.net/phpmysql/insert.html[/a] Note a couple of things - when you have more than 1 field in a database table you need to tell it which field is to receive the information --- to keep related data together enter them in to the database at the same time.. Lite...
  14. First, Happy Easter! Thank you for the responses. According to the webswoon site, it can be run from the command line; however, the documentation does not indicate the procedure. As such, I have sent an email to the author requesting information regarding the command line syntax as well as the feasibilty of using the program on my hosting server. Of course, taking the sledge-hammer approach, one could on the local computer use a task scheduler to (1) start apache and php (2) automatically modify the url file list (3) start webswoon (4) use an automated ftp client to transfer the resulting images to a remote host. Just looking for a simpler, more elegant solution. Will keep you posted. Lite...
  15. Its commonly called 'scraping'. Here is a class designed to do that. It will be necessary for you to develop the particular code to 'cull' the wheat from the chaff. [a href=\"http://www.free-php.org.uk/classes/robot.php\" target=\"_blank\"]http://www.free-php.org.uk/classes/robot.php[/a] Lite...
  16. Nice day, sun is shining, birds are singing and the old man is thinking outside the box again. I realize that this is not really a PHP question; however, I truely respect the knowledge that many of the people on his forum have (people like Toplay, Barand, AndyB, gizmola etc). So on to the question. Is it possible to 'run' a program/application on one's web site? ie. there is a free python program called webswoon, that seems to do what many recently have asked about here. It takes a 'snapshot' of a url and saves it as a jpg file. Obviously, one could set windows task manager to (1) start the program (2) save the jpg (3) start an ftp program to upload the jpg to one's web site. BUT.... Thanks, Lite...
  17. Usually, Excel only adds quotes to cells that contain commas ie if a cell contained an address -- Detroit, Michigan 48383 -- then the csv file would look like --- "Detroit, Michigan 48383" or quotes themselves ie -- he said ""Hi!"" would be -- "he said ""Hi!""" Also (not really positive here) , there may be some Preference settings in Excel that automatically will add quotes to cells containing text. Lite...
  18. First, if you will look under your keyboard you will discover that it is [b]gender-less[/b]. Next, learning php, mysql, how to cook turducken, how to wash clothes etc etc all require the same process. a. One step at a time b. study c. observe d. experiment IMHO, it is best to first define your ultimate objective. Then develop an outline, in plain english, of the information (data) you need to reach your goal and of the steps necessary. When you have that do a google search for each step. ie serach term: php snippet file upload OR php tutorial image resize. Its not really hard, IF you look at things as simply as possible and build in increments. Not exactly what you asked for, but a starting point. Lite..
  19. Although its not a php solution, this should accomplish what you want to do. [a href=\"http://www.codetoad.com/dhtml_thumbnail.asp\" target=\"_blank\"]http://www.codetoad.com/dhtml_thumbnail.asp[/a] Lite...
  20. Glad to have helped. all coded from scratch by hand. Excel has the ability to 'lock/protect' a spreadsheet so that other people are unable to make changes. It is a very helpful feature when you want to control what and where a user can input to a 'form'. here are some links to explain how to do it. [a href=\"http://www.meadinkent.co.uk/xlprotn.htm\" target=\"_blank\"]http://www.meadinkent.co.uk/xlprotn.htm[/a] [a href=\"http://j-walk.com/ss/excel/usertips/tip022.htm\" target=\"_blank\"]http://j-walk.com/ss/excel/usertips/tip022.htm[/a] [a href=\"http://www.mrexcel.com/archive/Formatting/14966.html\" target=\"_blank\"]http://www.mrexcel.com/archive/Formatting/14966.html[/a] [a href=\"http://www.google.com/search?hl=en&q=excel+protecting+cells\" target=\"_blank\"]http://www.google.com/search?hl=en&q=excel+protecting+cells[/a] As an aside, depending upon your 'clients' proficiency, there are FREE programs that will automatically upload the csv file to your site at scheduled times. Also as you develop your knowledge and understanding of php and mysql, you will see that there are ways to really streamline the code and make it more effective. Good Luck. Lite...
  21. Just in case (this old man just spent 30 mins doing this)... Since your 'clients' are not extremely computer literate AND in an effort to make things clear (oh sure) here is a suggestion 1. Have the 'client' use an Excel template to enter their data (see picture) 2. Have 'client' SAVE AS price.csv (comma separated) 3. Allow 'client' to upload price.csv 4. The following php script will gather and display the data (please note this is a very rough teaching script - it is NOT the most streamlined way to accomplish your objective BUT it works) [code]<?PHP ############################################ # this gets the price.csv file and displays the data # #    IMPORTANT: Array elements begin with the number 0 (zero) # #    this entire example is predicated upon the use of a #    predetermined excel template # #    as you become more proficient, you will be able to #    modify this script to dynamically adjust ############################################# ############################################################### # read the csv file into an array # #    this array has elements that represent each row of the excel file #    each element will have data separated by commas #    we will turn each element into a new array so that we can extract the data ############################################################### $array_01 = file("price.csv"); ################################################### # count the number of elements in the first array ################################################### $elements_01 = count($array_01); ####################################################################### # get the location - based upon our excel template # this information would be the 2nd piece of data in the first element #    in our example the first element looks like this #    location,London,,,,, $array_02 = explode(",", $array_01[0]); $location = $array_02[1]; ############################################################################ # get the months for which we have prices - based upon our excel template # this information would be the 2nd through 6th pieces of data in the 2nd element #    in our example the second element looks like this #    month,April,May,June,July,August $array_03 = explode(",", $array_01[1]); $month01 = $array_03[1]; $month02 = $array_03[2]; $month03 = $array_03[3]; $month04 = $array_03[4]; $month05 = $array_03[5]; #################################################################################### # get the crop names as well as the relevant prices - based upon our excel template # this information would be in the elements 3 through 5 #    in our example those elements look like this #    corn,12.5,9.75,8,13.37,6 #    soybean,3.25,4.68,5.23,4.5,2 #    wheat,7.5,4.75,2,10.37,23.98 $array_04 = explode(",", $array_01[2]); $array_05 = explode(",", $array_01[3]); $array_06 = explode(",", $array_01[4]); $crop_01_name = $array_04[0]; $crop_01_price01 = "$".number_format($array_04[1], 2, '.', ','); $crop_01_price02 = "$".number_format($array_04[2], 2, '.', ','); $crop_01_price03 = "$".number_format($array_04[3], 2, '.', ','); $crop_01_price04 = "$".number_format($array_04[4], 2, '.', ','); $crop_01_price05 = "$".number_format($array_04[5], 2, '.', ','); $crop_02_name = $array_05[0]; $crop_02_price01 = "$".number_format($array_05[1], 2, '.', ','); $crop_02_price02 = "$".number_format($array_05[2], 2, '.', ','); $crop_02_price03 = "$".number_format($array_05[3], 2, '.', ','); $crop_02_price04 = "$".number_format($array_05[4], 2, '.', ','); $crop_02_price05 = "$".number_format($array_05[5], 2, '.', ','); $crop_03_name = $array_06[0]; $crop_03_price01 = "$".number_format($array_06[1], 2, '.', ','); $crop_03_price02 = "$".number_format($array_06[2], 2, '.', ','); $crop_03_price03 = "$".number_format($array_06[3], 2, '.', ','); $crop_03_price04 = "$".number_format($array_06[4], 2, '.', ','); $crop_03_price05 = "$".number_format($array_06[5], 2, '.', ','); ################################################################### # display the data in a nicely formatted table ?> <center> <table width=50% Border = 1>   <tr>     <td colspan=6 align=center>       Location: <?PHP echo $location; ?>     </td>   </tr>   <tr>     <td></td>     <td align=center><?PHP echo $month01; ?></td>     <td align=center><?PHP echo $month02; ?></td>     <td align=center><?PHP echo $month03; ?></td>     <td align=center><?PHP echo $month04; ?></td>     <td align=center><?PHP echo $month05; ?></td>   </tr>   <tr>     <td><?PHP echo $crop_01_name; ?></td>     <td align=right><?PHP echo $crop_01_price01; ?></td>     <td align=right><?PHP echo $crop_01_price02; ?></td>     <td align=right><?PHP echo $crop_01_price03; ?></td>     <td align=right><?PHP echo $crop_01_price04; ?></td>     <td align=right><?PHP echo $crop_01_price05; ?></td>   </tr>   <tr>     <td><?PHP echo $crop_02_name; ?></td>     <td align=right><?PHP echo $crop_02_price01; ?></td>     <td align=right><?PHP echo $crop_02_price02; ?></td>     <td align=right><?PHP echo $crop_02_price03; ?></td>     <td align=right><?PHP echo $crop_02_price04; ?></td>     <td align=right><?PHP echo $crop_02_price05; ?></td>   </tr>   <tr>     <td><?PHP echo $crop_03_name; ?></td>     <td align=right><?PHP echo $crop_03_price01; ?></td>     <td align=right><?PHP echo $crop_03_price02; ?></td>     <td align=right><?PHP echo $crop_03_price03; ?></td>     <td align=right><?PHP echo $crop_03_price04; ?></td>     <td align=right><?PHP echo $crop_03_price05; ?></td>   </tr> </table> </center> <?PHP ?> [/code] A sample of the display is here [a href=\"http://nstoia.com/pricetest/price.php\" target=\"_blank\"]http://nstoia.com/pricetest/price.php[/a] An image of the excel template is here [a href=\"http://nstoia.com/pricetest/excel.jpg\" target=\"_blank\"]http://nstoia.com/pricetest/excel.jpg[/a] Hope this is of some help. Lite...
  22. Ok rather than writing the code for you, we are trying to make the concepts clear. try these two simple files. [code]<html> <head> <title>test form</title> </head> <body> Once you understand what is happening, modify this page to get the data you want <form action="testform01.php" method="post"> first name: <input type="text" name="firstname" size="40" maxlength="80" value=""><br> last name: <input type="text" name="lastname" size="40" maxlength="80" value=""><br> check this if you would like to see a summary: <input type="checkbox" name="showsummary" value="1"><br> <input type="submit" value="Submit"> </form> </body> </html>[/code] [code]<?PHP ##################### # this is the test form page 2 # $showsummary = $_POST['showsummary']; $firstname =  $_POST['firstname']; $lastname =  $_POST['lastname']; if (isset($showsummary)) {     echo "The checkbox was clicked <br>";     echo "Your name is " . $firstname . " " . $lastname;     //display your summary here } else {     echo "The checkbox wasn't clicked";     // do something else } ?>[/code] Hope this isn't too muddy. Lite...
  23. ok, had my meds and a glass of wine, ready to do battle (from the movie michael). I could be mistaken (its happened twice - once in 1953 and once in 1979) but when you click on the Summary link, for all intent and purposes, the data in the form is NOT submitted. As an experiment, do the following... 1. test form page that uses same fields BUT do not have the summary button/link. Instead, make an extra data field (a check box perhaps) that the user checks if they want to see a summary. 2. make the process page get the variables from the form using the POST method. 3. in the process page, IF the summary field has been checked, then display the summary. Else do your other processing. ie (psuedo php) [code] if (button == yes) { display summary; }else { do something else; }[/code] Lite...
  24. Your form page is using the POST method, while your summary page is using the GET method
  25. There is a tutorial for that here on PHPFreaks [a href=\"http://www.phpfreaks.com/tutorials/73/0.php\" target=\"_blank\"]http://www.phpfreaks.com/tutorials/73/0.php[/a] Lite...
×
×
  • 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.