[PHP] fwrite() blank-line Quirk?
Hi All, Relatively new PHP coder (was in an MS / ASP shop before)... I'm doing some flat-file manipulation (please, spare me the database comments, I'm working on it!), and I'm having to read strings out of one file and copy them into another until a while() condition is satisfied. The problem is, I seem to always end up with a blank line at the end of my files (which then screws up later file-processing) - I'm assuming because of the \n that fwrite() appends to the end of each string... Is there a simple way to get rid of this blank line or somehow get fwrite() to NOT put a newline on the end of a string? Thanks in Advance, --Noel Wade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] fgets() question?
Okay, attacking my flat-file issues from the other end: When you use $foo = fgets($fp_file); it appears that a blank line ends up looking exactly like a FALSE ("failed to read") return value... Is there any way to differentiate between an empty-string read (a blank line in a flat-file) and a FALSE return from fgets() ?? Thanks a bunch, --Noel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: fgets() question?
> A blank line should return the newline (\n or \r\n), according to > http://www.php.net/manual/en/function.fgets.php. Also try using '===' (3 = > signs) as the operator, which enforces type checking on a comparison). Yes or no: $foo == FALSE === 0; ??? Right now I'm just doing if($foo) And "\n" seems to equate to FALSE with this sort of conditional / comparison... Thanks, take care, --Noel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing Query_String or variables through multiple pages?
Hi all, I have an issue I'm hoping there's a simple answer for (I'm betting there is): I have a dynamic page where the user may click on a link - this link processes their data and shows them a "result" page... Then I want a variable (for a manual hypertext link) that contains the original URL they were viewing. The problem is, the original page / URL needs a query string (i.e. "?key1=val1&key2=val2&key3=val3..."). So I have to somehow pass their original query string THROUGH the "result page" via a GET, and without using a (using a POST form I could do it)... I've looked at manually copying and "forwarding" each original variable by including it in the URL for the "result page"; but I was hoping for something more elegant and flexible... Any thoughts or ideas? Thanks a bunch in advance! Take care, --Noel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can you insert into $_POST manually?
Hi all, So I have a page that processes information and then "echo"s out a redirect that looks like this: The thing is, there are some variables that I would love to pass in $_POST or $HTTP_POST_VARS to the page referred to in "$url". Is there any way to stuff this data into either of these globals so that the "$url" page can access 'em? Thanks a bunch! --Noel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: session not set, server configuration?
James - Don't know how you're working with Cookies and sessions for sure, but the default / "easy" way to check for an established session is to put "session_start();" at the top of every page that's going to access the session variables. That will check for an established/open session and make the registered session variables accessible to the page. Then a logical check is as simple as using "session_is_registered()" like this: if (session_is_registered("registered_variable_name")) //do something here if the person has already registered their session else //session not registered! Hope this helps! Take care, --Noel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can you insert into $_POST manually?
Thanks - I understand that method; but I'm really looking for a way to pass them without them being visible / mucking up the URL line with a buncha stuff... Take care, --Noel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can you insert into $_POST manually?
This will work perfectly! Actually, building a dynamic javascript function and/or hidden form will allow me to collapse a couple of other redirect systems on my site into one... Thanks a bunch! --Noel "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > You can also build a form with hidden variables and use > to submit it. For javascript > disabled browser put a > "Continue" submit button -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: how to passing two dimension array
You're missing string concatenation operators. I use "echo" instead of "print" - but here's how it should look with either: echo ""; Explanation: The \" makes the double-quote appear in the final HTML, then you have to use a plain " to end the text string. Then you use the . concatenation operator, followed by your variable. To add further text, use another . operator, then " to open up the text string, then \" for the HTML close-quote, then the > to close the HTML tag, then " to close out the echo or print statement. End with a ; Let me know if that helps! Take care, --Noel "Rizki Salamun" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > hi there.. > > I have a problem when I want to passing two dimension varible. I made this > variable from html form. > > like this: > > > > print ""; > ?> >a >b >... >... > > > > but when again I want to print the $vari[$i][$j, in the page2.php it > seems doesnt recognize this variable. > > > thanks > > -rizki- > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: how can I use an external 'template' file and still use PHP variables?
I agree with Edwin on this one. What's the <<< for?? Could it be you want to be doing this: $templatestring = include("/pathto/email_template.php"); $message = "<<" tags will be considered plain text. Put another way: Even though the "include" statement in the main document is ALREADY between PHP tags, the parser looks for an opening PHP tag in the included file to find where to begin parsing - anything before that opening tag is echo'ed out as plain text). Hope this helps! Take care, --Noel --- "Daevid Vincent" <[EMAIL PROTECTED]> wrote in message 006801c2b88d$69748a60$0801a8c0@telecom">news:006801c2b88d$69748a60$0801a8c0@telecom... > I've posted this a few weeks ago with no response. I want to use an > external > > $message = << include("/pathto/customer_email.php"); > HTMLMESSAGE; > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session vars vs. POST/GET vars?
Hi all, So I have a session variable; but with register_globals active on the server I'm hosted at (no way to turn it off), just checkng for "$varX" in my script could retrieve the session variable, a GET variable with the same name, or a POST variable with the same name - and as a security concern, someone could use a GET request (http://somehost/mypage.php?varX=0) to spoof the script into thinking that "varX" is the wrong value. So, is there any way in a script to specify that I want to retrieve the value stored in the registered session_variable("varX")?? Thanks, --Noel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Session vars vs. POST/GET vars?
Nevermind, just found the $HTTP_SESSION_VARS array... Thanks anyways! Take care, --Noel "Noel Wade" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi all, > > So I have a session variable; but with register_globals active on the server > I'm hosted at (no way to turn it off), just checkng for "$varX" in my script > could retrieve the session variable, a GET variable with the same name, or a > POST variable with the same name - and as a security concern, someone could > use a GET request (http://somehost/mypage.php?varX=0) to spoof the script > into thinking that "varX" is the wrong value. > > So, is there any way in a script to specify that I want to retrieve the > value stored in the registered session_variable("varX")?? > > Thanks, > > --Noel > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SELECT MULTIPLE form variable?
Hi all, So I was under the impression that an HTML form "SELECT MULTIPLE" item would return an array with all of the selected items. This array can then be used with any of the standard PHP array functions, yes? I have 1 HTML page that seems to work fine... However, another page that is nearly identical is failing - giving me the following error: "Wrong datatype for second argument in call to in_array". When I look at the variable, it seems to ONLY contain a string - the first item the user selected. The only difference I can see is that the working SELECT MULTIPLE has numerical values, and the dysfunctional one uses string values - but the values ARE enclosed in quotation-marks... so I don't know why they're not POSTing properly as an array. Is this a known bug or issue? Any thoughts or solutions? Thanks a bunch, take care, --Noel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SELECT MULTIPLE form variable?
Its the littlest things that kill ya Thanks a ton! As a side note, I definitely do NOT have the brackets on the working page - so its an undefined "feature" (or bug) that numerical-value SELECT MULTIPLE variables post as an array to PHP. Take care, and thanks again! --Noel - Original Message - From: "Leif K-Brooks" <[EMAIL PROTECTED]> To: "Noel Wade" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Saturday, June 14, 2003 1:26 PM Subject: Re: [PHP] SELECT MULTIPLE form variable? > You need to name it formfield[], not formfield. > > Noel Wade wrote: > > >Hi all, > > > >So I was under the impression that an HTML form "SELECT MULTIPLE" item would > >return an array with all of the selected items. This array can then be used > >with any of the standard PHP array functions, yes? > > > >I have 1 HTML page that seems to work fine... However, another page that is > >nearly identical is failing - giving me the following error: "Wrong > >datatype for second argument in call to in_array". When I look at the > >variable, it seems to ONLY contain a string - the first item the user > >selected. > > > >The only difference I can see is that the working SELECT MULTIPLE has > >numerical values, and the dysfunctional one uses string values - but the > >values ARE enclosed in quotation-marks... so I don't know why they're not > >POSTing properly as an array. Is this a known bug or issue? Any thoughts > >or solutions? > > > >Thanks a bunch, take care, > > > >--Noel > > > > > > > > > > > > -- > The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php editor?
My favorite little gem is a shareware program called Code-Genie (www.code-genie.com). Its cheap, fast, a "slim" app, provides tons of useful little features, and has TOTALLY user-configurable text-coloring. You can specify a particular coloring scheme for each file extension, so it automatically picks the scheme for the type of programming you're doing - very handy! Comes with schemes for all of the most common / simple programming languages, plus plenty of user-made files for download, too! It doesn't have any real debugging features, nor can it do fancy things like track your custom object-functions and color them or present their arguments - but for a quick, simple, helpful tool - its just perfect! Take care, --Noel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP help/example for booking program
Welcome, hope you enjoy PHP - its a great language! My best suggestion is to check out the book "PHP and MySQL Web Development" by Luke Welling and Laura Thomson - it provides you with all of the PHP & MySQL fundamentals and good concepts for how to design something like that. The book is aimed a little bit more at people who can already do some programming; but you should pick it up to start with, and if it doesn't make sense grab a smaller "beginner" book on programming and then come back to "PHP & MySQL" Good luck! Take care, --Noel - Original Message - From: "Giuliano" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, June 16, 2003 7:42 AM Subject: [PHP] Re: PHP help/example for booking program > Hi Other PHP Users, > > i am new PHP in the list; i am looking for some code example for a hotel or > residence booking program; can > someone help me with good tips? some code? > > i thank you for every help, bye > > Giuliano > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Forms / Array Question...
Hi All, Quickie Question... Possibly a silly one; but it would make my life easier if it works! I know that with a SELECT MULTIPLE, you have to use the convention: NAME="$varName[]" to get all of the responses into a nice neat array. I'm wondering about the mechanism behind this - is it simply doing a behind-the-scenes "$varName[] = X;", "$varName[] = Y;", "$varName[] = Z;" operation to dynamically generate the array? (Note: this is not my main question - keep reading. :-P ) If so, then it would follow that it's also possible to do something like this: ... And get a nice array with your text values. Anyone know if this (A) works and (B) is not actually just some undefined behavior that's risky to use? Thanks! Take care, --Noel