[PHP] Re: PHP-JavaScript
Would it be possible to have javascript insert a hidden input tag in the html and then php could pick it up? Just an idea, Andy Mëòv îçîÎ òsyïn wrote: Is it posible to get values from javascript to PHP? Without having to post the variables.. Thanks //Mårten _ Chatta med vänner online, prova MSN Messenger: http://messenger.msn.se -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP to another language
I was wondering if there are any tools to convert PHP to another scripting language? I have a script that only uses pretty basic functions in PHP (arrays, plain variables, nothing exciting- no dB things or anything like that) and am hoping there are some tools where you can get the majority of the code switched over to a more universal scripting langauge? I designed this 2000 script and then learned that our information systems people would feel a lot more comfortable using a language that they are already familier with. I originally designed it in PHP because for one it is the only scripting language that my university will allow your typical student to write in, and two because I wanted to learn PHP. So in order for my place of employment to actually use this script I made while learning PHP, they would like it if it could be converted to another language. I am still waiting on what languages they would be okay with, but thought I would start to check into the problem here first. Thanks for any information, Andrew V. Romero -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Writing Array to File w/o blank lines
I have been working on a script that manipulates arrays and now I am working on the part where the user can erase part of the array. Previously the function that writes the array to a file looked like: function updateSuspenderOrVehicleFile($fileToUpdate, $newDataArray) { $fileName = fopen( $fileToUpdate,w); for ($i=0; $icount($newDataArray); $i++) { //don't write blank lines left by remove feature if ($newDataArray[$i] != ) { //check to see if on the last solution, if not add line break at end. if ($i+1 == count($newDataArray) || $newDataArray[$i +1] == ) fwrite($fileName,$newDataArray[$i]); else fwrite($fileName,$newDataArray[$i]\r\n); } } } The problem is that when a user erases part of the array, I just set it to array[$number] == , which works except in the following cases. Lets say the user selects the last 2 array elements to erase, then when the function is called to write the array, it leaves a couple blank lines at the end of the file which messes up things later. Originally I though I would be easier to set the record they want to erase to , but is there another way to say compress the whole array together or a better way to do this? Thanks for any ideas, Andrew V. Romero -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Writing array to file w/o blanks- Update
Oops the function had one mistake in it (from me already trouble shooting this), it should be: function updateSuspenderOrVehicleFile($fileToUpdate, $newDataArray) { $fileName = fopen( $fileToUpdate,w); for ($i=0; $icount($newDataArray); $i++) { //don't write blanks left by remove feature if ($newDataArray[$i] != ) { //check to see if on the last solution, if not add line break at end. if ($i+1 == count($newDataArray)) //the older email had an OR statement here fwrite($fileName,$newDataArray[$i]); else fwrite($fileName,$newDataArray[$i]\r\n); } } } Thanks, Andrew V. Romero -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Licensing??
I am looking into installing php on some of our hospital servers and was wondering about licensing issues. Are you suppose to purchase any type of license for installing php on a commercial server? It seems a little on the strange side that they (the php people) would just let you install and use their product for free, what do they get out of it? Thanks for any information, Andrew V. Romero -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Ensuring that Form is only submitted once (session vars?)
I was wondering if there is a way to ensure that a form is only submitted once. I have a script that saves a lot of information to the disk and if the user uses the back button and then resubmits the form, it will cause major problems. I jave looked into using javascript to fix this, but it doesn't seem like there is an easy way using javascript. In the process of looking into this, someone recommended using a session variable. I have never used sesion variables, but tried a sample code in the documentation: ?php session_register (count); $count++; ? Hello visitor, you have seen this page ?php echo $count; ? times.p php? # the ?=SID? is necessary to preserve the session id # in the case that the user has disabled cookies ? To continue, A HREF=nextpage.php??=SID?click here/A but I get an error saying Warning: Cannot send session cookie - headers already sent by (output started at c:\server\apache\htdocs\session.phtml:5) and Warning: Cannot send session cache limiter - headers already sent (output started at c:\server\apache\htdocs\session.phtml:5) in c:\server\apache\htdocs\session.phtml. So two questions, first is a sesssion variable the way to go in ensuring that the user doesn't use the back button to resubmit a form, and secondly why am I getting this errors when I just cut and paste the example code into a sample page? Thanks for any direction and help, Andrew V. Romero -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Email files as attachments
I was wondering if it is possible to attach a file using the php mailing functions? I currently am using mail([EMAIL PROTECTED],My email subject Line,$emailMessage, From: [EMAIL PROTECTED]\nReply-To: [EMAIL PROTECTED]\nX-Mailer: PHP/ . phpversion()); to email simple messages, but I haven't run across a way to attach a file to it. Thanks for any information, Andrew V. Romero -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Passing Variables and the include command
I was wondering if it is possible to pass some variables to a php file that will be accessed via the include command? For example, I am working on creating a nicer hits counter and would like to just write the code for the counter once and then have each page access that counter.php3 and pass a variable which would contain the page name to counter.php3 so counter.php3 could write the new counter to a file with the pageName.log. Right now I am using a very simple counter: -counter.php3- $file = interest; $counterFile=fopen($file..log,r); $counterRecord = trim( fgets($counterFile, 4096) ); fclose($counterFile); $counterRecord++; $counterFile = fopen($file..log, w); fwrite($counterFile,$counterRecord); fclose($counterFile); Ideally, I would like to have each of my pages call counter.php3 using the include command and have the page pass it the variable $file. Any ideas? Thanks, Andrew V. Romero -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Order of focus for text entry inputs
I have a web page that is generated by a php script and on this page there are several html text entry slots such as echo bSpecial Notes:/binput name=\specialNotes\ size=\65\$prodNotes; on one page. I fill in several of these input slots with default values, but there are about 3-4 that require the user to manually type an answer. I was wondering if there was a way to control which text entry slots the cursor will go to when the user hits tab? Ideally I would like the cursor to automatically move first to the three that require the user to type something, and then move on to the slots that already have a default value. Is this possible in php, I didn't see any reference to giving items focus in the manual? If it is not possible in php, is there some way that I can have this web page (that is being generated by a php script) use javascript to create my desired order of focus? In general I have not seen any javascript inside a php script, although judging from a few other messages, this does seem to be possible. Thanks for any ideas, Andrew V. Romero -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Determining IP address
I was wondering if there is a way in PHP that you can determine the IP address? I am wondering because I am developing a simple web based program (in php) for use in a hospital setting and I want to do some checks to make sure that the program is not being run from a computer outside of the hospital. Instead of having user names and passwords, I thought it would be eaiser if I just checked the IP address, especially since this is not a program that really has to be secure, but I would like to prevent just anyone from using it. Is this possible with php? Thanks, Andrew V. Romero -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] 3d array-number of elements in each dimension
I have a 3d array $ingredientsInfoSplit[$i][$j][$k] and this array is contains $i-row that data (a compounded suspension) was found in, $j-ingredients for the suspension, and $k-information on each ingredient used for the suspension. So each row in this file I have contains all the information needed to make a particular suspension and this array breaks it down so that I can read each part seperately. First, would there be a better way to hold this information? This way seems to work well but I am not an expert yet and was wondering if this is how you would do it. Now for the real question, for each suspension I need to determine how many ingredients were used to create it. So I need a way to determine how many $j elements there are in $ingredientsInfoSplit[$i][$j][$k] . I have been looking at the count function but I can't figure out how I could use it to determine how many $j elements there are. Thanks for any help, Andrew V. Romero -Please remove all numbers from address to reply personally.- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] 3d array-number of elements in each dimension
I should clarify that I need to determine the number of elements in $j for each row ($k). Thanks, To reply personally, remove all numbers from address. Andrew V. Romero wrote: I have a 3d array $ingredientsInfoSplit[$i][$j][$k] and this array is contains $i-row that data (a compounded suspension) was found in, $j-ingredients for the suspension, and $k-information on each ingredient used for the suspension. So each row in this file I have contains all the information needed to make a particular suspension and this array breaks it down so that I can read each part seperately. First, would there be a better way to hold this information? This way seems to work well but I am not an expert yet and was wondering if this is how you would do it. Now for the real question, for each suspension I need to determine how many ingredients were used to create it. So I need a way to determine how many $j elements there are in $ingredientsInfoSplit[$i][$j][$k] . I have been looking at the count function but I can't figure out how I could use it to determine how many $j elements there are. Thanks for any help, Andrew V. Romero -Please remove all numbers from address to reply personally.- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Not losing variables in forms w/ checkboxes
I am working on creating some html forms (that are parsed by PHP) and need to use checkboxes, and was wondering how would you go about creating the checkboxes so that once the user hits the submit button, all of the checkbox variables are included? Right now I have: echo input TYPE =\checkbox\NAME=\suspendingAgent\ VALUE=\$availSuspendingAgentNames[$i]\ $availSuspendingAgentNames[$i]; In my understanding with how it is now, if the user chooses more than one suspending agent, only one suspending agent will be sent to the php file once the submit button is hit. The problem is that the program is pulling the names of an unknown number of suspendingAgents from a file so I can not just pick say two different names for the check boxes. The only solution that I have thought of is to create a NAME array then each checkbox would have its own name such as suspendingAgent[0], but this seems rather cumbersome seeing as I would then have to write more code to figure out which check box names were checked. So I was wondering if there was an easier way to go about this? It would be excellent if there was someway to have the script combine all the values of the checked check boxes into one value seperated by commas and have it still with the name of suspendingAgent. Thanks for any ideas, Andrew V. Romero To reply personally, remove all numbers from my address. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] html forms, reading writing data, etc
First thanks to all the ideas for reading one word from a file, but I hit another snag. Here is what I am trying to accomplish. I have a text file (questionFile.txt) and it contains questions that can be arranged like: 1. Question One A1. Question OneA C. Question Three For this email, I will call the 1. A1. C. all question numbers. So my first php script reads this file and for each question it creates a place for a user to enter the answer and each answer input has should have a name that correspondes to each question number (e.g. 1. A1. C. or whatever comes before the period). So the code that does this is ($wd is the file that contains the questions): while(!feof($wd) ) { $question = trim( fgets($wd, 4096) ); if (strlen($question)) { $questionWordArray = explode(" ", $question); $currentQuestionNumber = $questionWordArray[0]; //$questionNumberArray[$questionCounter]=$currentQuestionNumber; echo "$question input NAME=\"$currentQuestionNumber\"br"; //echo "input type=\"hidden\" name=\"questionNumberArray[$questionCounter]\" value=\"$questionNumberArray[$questionCounter]\""; $questionCounter++; } } Then once the user enters answers to the questions he or she knows, they hit the submit button and my second script takes that data, writes it to the answer file and displays all the other answers that people have entered for these questions. I was trying to get the answer file to be written in the following manner: 1. First person that answers questoin 1 A1. First person that answers question A1 1. Second person that answers question 2 C. first person to answer question C. Then for displaying the questions and all the answers for that questions, I was having the second script, print the first question and then compare the first question's question number to each of the question numbers in the answer file and if they match then it prints that answer and continues to search for more answers for that question. My problem is in writing this answer file. Since the name of the input field for the questions is the question Numbers, I don't see how to differentiate the value contained in $currentQuestionNumber. $currentQuestionNumber is the name of each of the input fields and it also should contain the data that the user enters for the answer to the question. When I am trying to write the answer file, I am not sure how to get access to the answer the user put in, when I try to just write $currentQuestionNumber for each of the questions, it just writes 1. 1. A1. A1. C. C. instead of 1. Answer 1 here A2. Answer A2 here C. Answer C here. I was playing around with putting all the $currentQuestionNumber into an array (as you can see from the commented out section) in hopes that then I could use those to refer to the actual answer but that didn't work. So how would you go about doing this? ---Andrew V. Romero If you want to reply personally, remove all numbers from my address. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Read one word in file
I have a php script that reads a file that looks something like this: 1. Question One goes here: 2. Question two goes here: I need someway to have the script just read either the 1. or just the 1 When I first made the script I just had the program read the line using $questionBuffer = fgets($wq, 4096); and then I got the number by using a substring message: $currentQuestion = substr("$questionBuffer",0,1); and this works fine until I hit questions like 10 11... So how should I go about just getting the question number, ideally I would like to just read up until the first space is encountered. Is there a function to do that or will I need to create a for loop that goes through and compares each substring of 1 character to " ", and then once that " " is found, create a substring up until that " " character was found? Any ideas? --Andrew V. Romero To reply personally, remove all numbers from my address. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] command that gives current location of script
I though in flipping through the manual that I had come across a command that gives the location of where the script is being run from, but I have been searching for half an hour and can't find it now. Isn't it something like $php_self? Anyone kow what I am talking about? Thanks, Andrew V. Romero to reply personally, remove all numbers from address. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Search display *.txt files in dir
Is there a way to have php display all the .txt files in a directory? I checked in the manual but didn't see anything that would seem to help me do this. Thanks for any help. -Andrew V. Romero To reply personally, remove all numbers from my address. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Multi-Step Script
Is it possible to use different parts of one php script for multiple html forms? I am not seeing how people create multiple pages of html forms with each form importing information from the previous form. Right now, for each html form page I have, I create one php script to handle it but it would be nice to have just one php script in which only certain parts execute depending on have variables have assignments. One way I was thinking of doing this is to have the html forms just keep posting the information to itself whenever the submit button is hit and then using a series of if else statements to evaluate where the program is in relationship to the forms, would this type of system work? What do you guys do? -Andrew V. Romero To reply personally, remove all numbers from address. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Search display *.txt files in dir
Wow, that exact question was asked. Sorry everyone. Thanks anyway. David Robley wrote: On Wed, 14 Mar 2001 15:20, Andrew V. Romero wrote: Is there a way to have php display all the .txt files in a directory? I checked in the manual but didn't see anything that would seem to help me do this. Thanks for any help. Wasn't this already asked and answered today? Anyhow, see the example for readdir; you just need to expand the second example with a test (regex, substr, whatever) that tests for .txt on the end of the filename. -- David Robley| WEBMASTER Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet| http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Test if File Exist, if not, use default file name
Lately I have been working on a script and my plan is to have the URL pass an initial variable to the script. So for example, the URL would be http://WhereEverServer.com?questionFileName=testQA. This variable called questionFileName is the name of a file (without the extension) that the script will use to pull a series of questions from. What I would like to have the script do is to check if a variable was passed, and to check if the file name passed actually exist. If either case is false then I would like to have it check if the file testQA exist and if so then the script would run using this test file, if not then the script would just terminate giving the user an error message. I was wondering how you would do this? Right now I have it semi-working, but it is very convoluted and if the variable is not passed it displays a "Warning: Undefined variable: questionFileName in c:\server\apache\htdocs\survey\questionanswer.phtml".Ideally it would not display this message and just check if the testQA file is around and if not then just terminate with an error message of my choice. -Thanks for any ideas, Andrew V. Romero To reply personally, remove all numbers from my address. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]