[PHP] Passing JAVASCRIPT variable to PHP Script...
Hi geeks, i am uploading a file to server. Uploading part is working fine. i am struggle with minor part. actually before uploading file, i am checking for existance of a file. If it is not exists, directly i am uploading that file. If it exists, i sud ask user that This file is exits. Do You really want to Upload it?...If YES, i will overwrite it. otherwise, i won't do anything. i am using javascript for popup windows. i used confirm() function(CANCEL / OK). the problem is, i am not able to get the variable value for php script. Of course, php is server side programming language javascript client side programming language. Plz see my code give the solution. See my progress: upload.php # Checking for the File existance if (file_exists($fullPath)) { echo script language='JavaScript'if(confirm('This file is already Exists ! Do You Want to Duplicate ?')) { var s=1;} else {var s=0;} /script; $decide=script language='JavaScript'document.write(s)/script; echo $decide; if (!$decide) { // Don't Upload exit; } else { // Upload the file } In this code, echo $decide; is printing whether 1 or 0. But by using that variable, i cudn't proceed further. Bcoz it is not useful for manipulating. * Is anyway to store that variable value in a static file, so that, i can proceed easily. * Is it possible to execute shell commands by javascript, so that i can create file store this variable. If it is not possible, plz give any other solution. Expecting ur reply. Thanks in advance Prabhakaran. -- View this message in context: http://www.nabble.com/Passing-JAVASCRIPT-variable-to-PHP-Script...-tf2415628.html#a6733549 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] POPUP window in PHP
hi, i want to do YES/NO confirmation (like POPUP). If YES, it will upload a file into server. Otherwise, it won't do anything. In JavaScript, i can get using confirm(); But i am not able to do manipulation from that javascript variable. My Code(partial): ? if (file_exists($fullPath)) { echo ; $decide=??php; # It is Printing either 0 or 1. But I can't able to manipulate further. For eg, i can't do like the following, if ($decide) { // Upload } else { // Don't Upload } } Please help me reg this..Please provide some solution for this..Thanks in advance. ---Prabhakaran -- View this message in context: http://www.nabble.com/POPUP-window-in-PHP-tf2408946.html#a6714594 Sent from the PHP - General mailing list archive at Nabble.com.
Re: [PHP] POPUP window in PHP
hi dude, actually, i am new to php. i am not understanding clearly. plz explain it clearly. My requirement is, i want to upload one file. i am checking whether it exists or not in Server side. If it exists, i am popping up a window that Do u want to have Duplication of this file?.If YES, i sud upload. otherwise i sud giveup. In script update part if once u uploaded one script from your PC (client) and after some time u r editing or making change to the file(client). and wish to put into that then it will ask for duplicate. that part you need to think. Please reply to me. Thanks again. Prabhakaran Max Belushkin wrote: Captain wrote: hi, i want to do YES/NO confirmation (like POPUP). If YES, it will upload a file PHP is server-side, not client-side. You can have the confirmation passed as a GET variable in a two-step process for example, i.e. first show a confirmation form if $_GET[confirm] is not set, else check $_GET[confirm] and process the uploaded file. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- View this message in context: http://www.nabble.com/POPUP-window-in-PHP-tf2408946.html#a6715723 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] preg_replace problem
I have a regular expression that's not giving me the results i really need. I have a bunch of strings coming at me that need to be truncated if they're over 15 characters... but not to truncate until after it reaches the first word. This regular expression just doesn't seem to want to work 100%: $myString = preg_replace("/.{15}\w)?\s.*/","\\1",$myString); This will turn: 'PROJECT - Marketing Pitch' into 'PROJECT - Marketing\1' However... when i change it to: /(.{15}\w)+.*/ everything seems to work fine. I can't really use this regex though, because it will keep matching that 15 character word until it reaches the end. I need it to stop matching after it finds the first match (if it needs to match at all). In perl: + - means match 1 or many times * - means match 0 or many times ? - means match 0 or 1 time Could someone help me see my error... i'm driving myself bananas trying to find it. Perhaps pcre in PHP doesn't support the ? in the regular expressions. Best Regards, Rob -- 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]