Re[2]: [PHP] is it possible to communicate javascript and php?
I've used the tag in Internet Exploder to talk to the server via javascript. It may be possible using a regular frame also. Here's the low down on how I did it. 1.) Some onclick, onchange ... action calls a javascript function that looks like this function getData() { document.all.hidden_frame.src = "databaseactions.php?getmesomedata=something"; } 2.) The output of databaseactions.php would look like var contacts = new Array("Jeff Boyer","555-555-); Put something here for debugging The frame is hidden (width and height set to 0) so the client does not see the output. 3.) A function on the main page called loadselectbox gets the array of data returned from the server. You need to rawurlencode the data elements in the array or javascript will complain. Tuna Out, Dustin > Hello Alex, > > Sunday, January 21, 2001, 4:20:53 AM, you wrote: > > AB> no without submitting information to the server with get or post. > > AB> for example, if a bit of javascript you have comes up > with some value, the > AB> only way you can get it to the server is to put it in a > get and send the > AB> user to that url: > > AB> http://www.mysite.com/index.php?your_js_var=your_value > > You could also post WDDX packets generated by JS, if you intend to > operate with large and complex data. Sometimes it's much more > convenient. But, of course, using POST, cause PHP haven't learned mind > reading yet :) > > -- > Best regards, > Max A. Derkachev mailto:[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] exec() bug?
Hi, Can someone confirm this behavior on their system. I've tried it on 4.0.2 and 4.03pl1, both on Linux boxes, both with the same results. echo "One Character: " . exec("echo 't'",$tmp) . "\n"; echo "One Character: " . $tmp[0] . "\n"; echo "Two Characters: " . exec("echo 'te'",$tmp) . "\n"; My output is: One Character: One Character: t Two Characters: te It seems if the output of exec is one character it gets discarded somewhere. The ouput is correct in the array argument, but the "last line of output" is not returned by the function if the length of the "last line of output" is 1. Thanks, Dustin -- 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] how do you erase quotes from variable?
> I have a variable(s) that hold the string: > > "name" > > and I'd like to kill the quotes so it contains: > > name > > I am aware of the strlen() function but can find the concant > > Little Help? > > Mike If you *know* the variable is quoted you could also do: $new = substr($variable, 1, -1); I think this would be faster if you were doing a zillion of them as it doesn't have to find the quotes. Dustin -- 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] Splitting at word count
> I'm doing a page where the front page will show "news" > stories. What I'd > like is if the story is longer than X words/chars/etc, the > index page will > show the first X words, then a link for the full story. > > Does anyone have a good idea on how to split after a certain number of > words? > > Thanks, > Wade Put the story in an array and grab the first x elements? Say you want 50 words you would do: $num_of_words = 50; $story_array = explode(" ", $story, $num_of_words); $story_preview = implode(" ", array_pop($story)); Assuming all words are seperated by a space. Dustin -- 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] Strange problem
There are FTP functions if it's an FTP download. You could also use socket functions to create the request if it's HTTP. Check your system for the utility called wget, you could exec() wget to retrieve the file also. Dustin > -Original Message- > From: Jeroen Jochems [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 25, 2001 7:23 AM > To: Hardy Merrill > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] Strange problem > > > Or does anyone know a better way to download files? > > > - Original Message - > From: Hardy Merrill <[EMAIL PROTECTED]> > To: Jeroen Jochems <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Thursday, January 25, 2001 2:50 PM > Subject: Re: [PHP] Strange problem > > > > The first thing I'd check is the space on the client machine > > trying to do the download - that machine may be running out > > of space. I can't remember exactly how the browser handles > > this, but the client machine may need 2 times the size of the > > file to be downloaded - it might first create a temporary file, > > and then when the download is done, copy the temporary file to the > > real file. > > > > HTH. > > > > -- > > Hardy Merrill > > Mission Critical Linux, Inc. > > http://www.missioncriticallinux.com > > > > Jeroen Jochems [[EMAIL PROTECTED]] wrote: > > > When I try to download a big file (like 5meg) with > fopen() I get some > strange errors: > > > > > > - not enough space for lowio initialization > > > - not enough space for stdio initialization > > > - pure virtual function call > > > - not enough space for _onexit/atexit table > > > - unable to open console device > > > - unexpected heap error > > > - unexpected multithread lock error > > > - not enough space for thread data abnormal program termination > > > - not enough space for environment > > > - not enough space for arguments > > > > > > I use the following code > > > > > > while (!feof($file)) { > > > $line = fgets($file, 1); > > > fputs($localfile,"$line"); > > > } > > > > > > This always happens when he downloaded 981kb. Anyone know > how to solve > this? > > > > > > 10xzs > > > - floating point not loaded -- 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] Problem with a regex!
Zack, Your not going to find {title} when $var = "TITLE". Everything PHP is case sensitive. Also $string is not changed if there are matches, ereg_replace returns the modified string. HTH Dustin > I tried ereg_replace("\{" . $var . "\}",$value,$string) and > it didnt return > an error... but it didnt replace anything. > Other ideas ? Either {'s are > impossible to escape or php just doesnt like me... > > --- CC Zona <[EMAIL PROTECTED]> > > wrote: > >In article <[EMAIL PROTECTED]>, > >[EMAIL PROTECTED] (Zack Ham) wrote: > > > >> What I'm trying to do is run through it and replace > {title} with an > >> appropriate value. I have tried running > >> ereg_replace("{$var}",$value,$string) and > >> ereg_replace("\{$var\}",$value,$string). Neither work. > They either do > >> nothing or produce the error "Warning: invalid content of \{\}". > > > >Is $var=="title" (same case, no leading/trailing whitespace, etc.)? > > > >If so, then perhaps try: > > ereg_replace("\{" . $title . "\}",$value,$string) > > > >If not, then perhaps one of these: > > eregi_replace("\{" . $title . "\}",$value,$string) > > eregi_replace("\{title\}",$value,$string) -- 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]