Echo Error In Selected File
Is there a way of echo'ing a reported error in a selected file, Like if i have a file exists validation can i echo the reported error in my file_exists.php file and place the echo on the page where i want it to show?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
List All But Echo In Checkbox Only Selected
There is a 3 table: I want to list all the product groups but to be checked in checkbox only what choose the user. If from outside (choos.php?tt_reg_id=1) user is nr 1 then in listed checkboxes need to be checked only those checkboxes what the user nr 1 choose / but listed the all product groups. Code:
Any Idea Why Echo Selected Isn't Working In Mozilla?
Why does this work in Internet Explorer, but not Mozilla? I'm reading from a flat file. As an examle the value of colm1 read from the file is B. I set in the form page; <?php $A = 'A' $B = 'B' ; $C = 'C' ?> <select class="inform" name="colm1"> <option value="A" <?php if (strcmp($colm1,$A)==0) echo "selected='$colm1'"; ?>>A</option> <option value="B" <?php if (strcmp($colm1,$B)==0) echo "selected='$colm1'"; ?>>B</option> <option value="C" <?php if (strcmp($colm1,$C)==0) echo "selected='$colm1'"; ?>>C</option> </select>
Echo: How To View/call Data From Separate File Into Echo
I would like to ask about echo "<--statement==>"; Ok my senario let say like this i got a file name as datax01.php & script.php Let say on script.php i got a code to use echo. So how from echo i can recall datax01.php to view on that script? Code:
Renaming A User Selected File
I have an upload script that allows users to upload images to the server/database. My problem is that if a user uploads a file with the name of a file that already exists on the server, it overwrites the existing file. If I have a script that randomly generates 3 letters/numbers, how would I insert those in between the file name and the file extension? I'm thinking the solution would have something to do with implode, but I'm not sure how I would use it. I'm using the $_FILES['upfile']['name'] variable.
How To Pass The Value Of Selected Dropdown Menu To Another File?
there is a php-myql script that list the mysql databases in the drop-down menu, use wil select one and the submit button should pass the value or variable $db_name to the test.php, this script list the databases in the drop-down menu but when i select one and then click on submit cannot pass the db_name to the test.php:
Is An Include Error-echo Possible?
So far everything works well, however, when someone tries to 'hack' my site (or in case of a faulty link), things will go completely wrong. I am including the pages as such: if(isSet($page)){ include("pages/".$page.".php"); }else{ include("news.php"); } Whenever things go wrong, it'll go like this: Warning: main(pages/ohoh.php): failed to open stream: No such file or directory in /home/mememe/public_html/index.php on line 69 Warning: main(pages/ohoh.php): failed to open stream: No such file or directory in /home/mememe/public_html/index.php on line 69 Warning: main(): Failed opening 'pages/ohoh.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/mememe/public_html/index.php on line 69 Is there any way to make an errorthing for this? Like that it just echos 'Error', instead of the php-warnings?
Echo Or Printing An Error?
I can never figure out how to properly echo or print my errors so I can find the problem. My form is not entering the information to the database, its not emailing the information, and its not redirecting to the page listed in the header. It seems like it just refreshes the page. Code:
Echo File MD5
Any idea why this: echo "MD5: " . md5_file($_FILES["file"]["file"]); doesn't work?
A Closing Echo In Include() File?
Is it somehow possible to include() a .php file in a php document when the php file is something like this: <td></td>'; echo ' <td>... In other words, to include a php file that has a closing and starting echo. How could I do that?
Multiple Selected="selected" In A List.
I have a database with 1 to many and the many is a list with multiple selects in a list. When I click on a master record I have as part of my form the select statement for the multiple choice list. I want the list to highlight the multiple chosen values. here is part of the code. $dresscat = specdresscat($dresstypeid); //this is the query to get the values in the detail table $drcatrow = pg_fetch_array($dresscat);// the array for the detail table. <select name="stages[]" multiple="multiple"> <?php $allstages = allstages(); // this is a function to query my database to get the value for the list. while ($allstagerows=pg_fetch_array($allstages)) { $eachstage= $allstagerows["stageid"]; $specstage= $drcatrow["stageid"]; // this is the point I need help if ($specstage == $eachstage){ ?> <option value=<?php echo $eachstage;?> selected="selected"><?php echo allstagerows["stage"]?></option> <?php }else{ ?> <option value=<?php echo $eachstage;?>><?php echo $allstagerows["stage"]?></option> <?php } } ?> </select>
Receive File And Save Or Echo The Content
I want to send a file "a.b" and I want server to save this file on the server in filename "abcde" then I will send the file content as buffer and include the following header Content-Disposition: attachment; filename=abcde; and if I want to send a stream I will have the following header Content-Disposition: inline I want the server to echo the content of the buffer and save the file in the filename variable. I am aware of the form interface, but I do not want the server side script to read form data. Instead I want to telnet to the server which can take the post request and follow my wishes. The following two scripts do not serve the purpose, What need I change in these scripts so that I can do the needful. <?php print_r($_POST); ?> ************** to echo the content and <?php $uploaddir = '/var/www/uploads/' $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); echo '<pre>' if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { echo "File is valid, and was successfully uploaded. "; } else { echo "Possible file upload attack! "; } echo 'Here is some more debugging info:' print_r($_FILES); print "</pre>"; ?>
PHP File Upload Unexpected Error - File Too Large?
I have a short basic script to upload files. It works fine with small files, but with longer files it gets stuck. Here's the fragment, the input file is loaded in "$file" from an HTML form as usual. .... $img_str = fread(fopen($file, "r"), filesize($file)); $data = addslashes($img_str); // --------------------- up to here the execution is correct and fast (<1 second) $sql="INSERT INTO $table (". " file_name,". " file_type,". " file_size,". " bin_data)". " VALUES (". " '$file_name',". " '$file_type',". " '$file_size',". " '$data')"; // --------------------- it gets stuck here!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! mysql_query($sql) or die ("SQL error ..$sql"); I have already set the php.ini variables as follows: memory_limit = 16M upload_max_filesize = 6M I also checked the execution time to max_execution_time = 300 (even though I don't believe it should be necessary). The server is a P4 1.8 GHz, 256MB RAM
No Database Selected
what I've got it a simple system that includes pages the reference to which are in a database. This bit worked a treat. until i tried to put something that did some work in one of the included pages. PHP Code:
Selected Box Action
how to set the respond to action when user choose an option inside a <select></select> box? eg. when user select an option in the <select> box then php search for data inside mysql and then display the required data on the <input type=text>.
Php Dropdown - Selected?
i'm using this to pull information from a database and display it in a dropdown list. The problem is I am using the name code when I goto the "Update" page, but i'm not sure how to add the "selected" field, that way what ever I saved in the database will load. Example: I goto add and it add's the "id" of 7 to the field, when I load the page again it auto's back to 1 instead of clicking in-to 7 as thats whats already there... = ) Code:
Remember Selected Value DropDown
I am attempting to have a drop down menu that displays url from 1 table called links the same table also contains a name for the url. i.e. google.com = name and http://www.google.com = url The value of just the url from links is stored in a separate table called users in a field named search after form is submitted by user. Everything Posts correctly except when go back to edit the record and submit the form the drop down box does not retain the value of what had been previously selected although it is the correct record until form is updated when whatever value is currently in the drop down list will update the record. I know the code is doing exactly what it is told to do, because I have no functionality in it to recall the value from the field search in the users table. I don't know if it is something I would have to add to the array or option value. I can get it to work if it is all hard coded, but I am attempting not to do this. I am pretty new to php mysql and any help is greatly appreciated. This is the code I am working with that came mostly from a tutorial. PHP Code:
How To Give A Value To Non Selected Checkbox
I would like to get a value for a non selected checkbox in a form. Imagine my form contains : <input type='checkbox' name='t[0]' value=Ƈ'> <input type='checkbox' name='t[1]' value=Ƈ'> When I analyse $t, if first checkbox is not selected and second is, I have : $t[0] has no value. $t[1] equals 1 and count($t) equals 1 I would like to find a way to get : $t[0] equals 0. $t[1] equals 1 and count($t) equals 2
Resize Only Selected Images
I have an image upload script that is resizing every image that a user uploads. What I would like to do is have a check box added to the upload form that a user can check to resize the image if they want to or leave it unchecked to just upload the image. So if the box is checked the original image gets uploaded and a resized image is created as well If the box is not checked just the original image uploaded. I tried adding a check box but every image still was resized - checked or not - Im assiming because it was in the foreach loop so I dont know what to do. Code:
PHP And A Pre-selected Option In A Form
I've got a little text editor thing on my site, and to open a file, you input the file name and choose the folder from a drop-down list and click the Open button. The default filename is "index" and that file keeps track of all the files contained in that folder. It works okay. What's annoying is that regardless of what folder you're messing around in, the drop down list always goes back to showing the default folder name as the page is reloaded. I want it to be preselected to the folder it's in. It seems simple enough--the folder you're in is $_GET['dir']. But I've read some HTML form how-tos, and I can only see that you can preselect using the tabindex="" or selected attribute.
Radio Button Selected
What I wish to do is have a radio button pre-selected depending on what is pulled from the database. For example if I had 2 radio buttons: o Yes o No One has the value 1 and the other has the value 0 If 1 is selected from the database then Yes is pre-selected, else 0 is pre-selected. How would I do this?
Setting Selected Option Using PHP
I have a drop down list which I want to be set to what was selected when the form is submitted. As the form is processed by the same page, it returns to the preset default. How would I go about making this selection box set the option selected on the next page?
Parsing A Big Xml File Gives Seg Error
Hi, I'm parsing a *very* big xml file (600MB+) in order to do multiple inserts into a mysql table, but after about 80,000 inserts (5 minutes) I get a seg fault and obviously the script stops. I'm expecting it to get up to around 1 million rows. The method I'm employing to read the file in follows and then one of my xml_element handlers does the insert, which i didn't bother showing for the sake of brevity. <? # snipped code function grab_file($parser,$file) { #<snip> while($data = fread($handle, 4096)) { xml_parse($parser, $data, feof($handle)); } #<snip> } $parser = xml_parser_create(); xml_set_element_handler($parser, "start_xml_element", "stop_xml_element"); xml_set_character_data_handler($parser, "character_xml_data"); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); grab_file($parser, $file); xml_parser_free($parser); ?> The script itself seems to be working fine as I tested it with much smaller data set and it went like a breeze, so I'm assuming this is coming down to system resources. Under normal load the box has about 20MB of free memory (64MB max) and about 300MB swap space (400MB+ max). Just before my seg fault, free mem had fallen to less than 1MB and swap space was down to 200MB, the 'size' of the script in ps view was 200MB+ So, when I'm reading this file in, does php not just buffer the 4KB that it's useing for that particular loop? and throw it away when finished? This doesn't seem to be the case, but I'm confused as to how the script can be taking up 200MB, possibly the xml parsing functions are buffering the whole thing? In short, how can I keep memory useage down (by a large factor)?
File Get Contents() Error
I made a PHP5 script that uses the file_get_contents() funtion and when I run the script, I get this error: Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration I called my host up and they said that it is a coding error, not a security or server error, Here is the code: <?php $address = "http://www.example.com"; echo htmlspecialchars(file_get_contents($address)); ?>
Parse Error On File Using PHP 4.3.10
My hosting service uses PHP 4.3.10 and when I run a php script which works perfectly on my local lan linux server on my hosting service I get this error:- Parse error: parse error, unexpected T_STRING, expecting ')' in /home/fhlinux199/s/user/htdocs/graph_all.php on line 1114 When I look at the file I can find nothing wrong, as I say on my linux box with a later level of PHP it parses fine and executes. If I edit the file and simply add a blank char on the offending line the parse error moves to a different line in the file, this keeps happening every time I do an edit and it moves again. Usually to a line earlier in the file which it parsed OK on the previous run, and not always a ) causing the problem. I've asked the hosting service about this but they are not interested! Anyone know if this is a known problem? I have double checked that I uploaded it correctly as ASCII. Other PHP scripts work OK.
File Listing Error!
I've been having trouble with my php code lately, first when i tried to make it so noone could leech files with some .htaccess stuff i got 500 internal server error's, when i removed it [.htaccess] my script stopped working completely, can you please check the code and see what i did wrong (note: this script is supposed to display all the files in the directory. Using a Include) PHP Code:
File Upload Error
I am constantly getting this error when I try to run a php script (form based) that allows a user to upload a file... Warning: copy(/files/jack_album.jpg): failed to open stream: No such file or directory in /home/seeasale/public_html/load.php on line 155 Error Uploading File. Things I know... - the file does exist on my hard drive - permissions are set correctly for the folder on the server (777) - the files folder does exist (I have tried several ways to reference it in the .php file - all give the same error result).
File System Error
"Warning: Unable to create '/banners/uploaded':" I get this error after i upload a file and attempt to copy it to /banners/uploaded. Is this error telling me there is no dir named /banners/uploaded or that it can't copy to it for some reason or another?
No Input File Specified Error
My server is Win2003 with php 5.2. Basic webroot is pointed to c:inetpubwwwroot. When I execute php scripts in this dir, it is working fine. I configured a virtual directory in IIS onto different drive, D:WebsitesNewDir, and copied some php scripts. When I run those php scripts, in virtual directory, it is showing "No Input file specified" error. How to get the scripts in vir dir running?
File Copy Error
Here's a piece of code I'm running on my server though I keep getting the following error. I'm not too sure what might be the issue, however, I have the permissions set properly - though I doubt if I'm using the right folder paths. Cheers and regards, The Code:
Error 500 And Download Php File
when i execute php files in folder other than the document root, i get error 500 and the php file is downloaded to my browser with the 500 error code. I think it could be related to my modules. or my folder options LoadModule perl_module modules/mod_perl.so LoadModule cgi_module modules/mod_cgi.so LoadModule authz_host_module modules/mod_authz_host.so LoadModule autoindex_module modules/mod_autoindex.so LoadModule alias_module modules/mod_alias.so #LoadModule python_module modules/mod_python.so LoadModule php5_module modules/libphp5.so LoadModule mime_module modules/mod_mime.so LoadModule negotiation_module modules/mod_negotiation.so LoadModule userdir_module modules/mod_userdir.so LoadModule dir_module modules/mod_dir.so LoadModule vhost_alias_module modules/mod_vhost_alias.so LoadModule log_config_module modules/mod_log_config.so LoadModule ssl_module modules/mod_ssl.so LoadModule setenvif_module modules/mod_setenvif.so ScriptAlias /testscript "/usr/local/test/public/testscript" <Directory "/usr/local/test/public/testscript"> Options Indexes FollowSymLinks MultiViews Includes +ExecCGI AllowOverride ALL Order allow,deny Allow from all Options +ExecCGI </Directory>
No Input File Specified Error.
I have PHP 5 installed with IIS 6. Currently there is only one website that's using PHP at the moment, so I went ahead and enabled PHP for another website, but whenever I try to access this new website that's using PHP, I get a message saying "No input file specified." I don't know what could be causing this error, I tried doing a Google search and I found that there are a lot of people getting this same error message but I could not find any solution for it. Does anyone know how to solve this error?
Error Says Can't See Include File, Yet Executes Some Code On Include File
I am using an include_once() command to include a file that sits a level above the file view.php. when the code is run, I have an error as follows: Warning: include_once(../common.php) [function.include-once]: failed to open stream: No such file or directory in C:Program Files.. view.php on line 2 Warning: include_once() [function.include]: Failed opening '../ common.php' for inclusion (include_path='.;C:Program Filesxamppphp pear') in C:Program Files...view.php on line 2 The include command is simply: include_once(../common.php) - the '../' before the 'common.php' to indicate a level above the current file level. Is this right? I could not find a resource to confirm this. The strange thing is that while the error seems to imply that the calling file, view.php cannot 'see' the common.php file, other functions called from the 'common.php' file executes correctly and on the same calling file/page (view.php). Appears to the a double take - quite confusing -
Export MYSQL Selected Rows
Any ideas on how to export selected rows from a mysql table into a schema.sql file? I want to use mysqldump --opt database table but I don't wanna dump the whole table only results of a select. PHPMyAdmin does it but I need to do it in shell script code.
Get The Info Depending On The Selected Option
I have a page that is intendend to update a table field on DB i have a drop down menu wich displays all the position fields available on db and a text area where i will insert the new data. now the problem: I'm using the query SELECT * FROM table WHERE position = $position the $position is the choosen option from the drop down menu. then have echo "<textarea>$functions</textarea>" where it will show to me the present data available on DB after all this, i have another query UPDATE table SET functions = $functions WHERE position = $position All is ok and working except the fact that he doesn't displays $functions when selecting a option from the drop down menu?
1 Record In Database But 2 Records Were Selected?
i'm retrieving a record from database. below the record, i have a yes and no button, where i can let user click and then count the number of yes and no. everything works fine, but when i start to click the yes or no button, my record ,becomes two records. i only have one record in my database, but two same record was displayed. this is the code: PHP Code:
Selected Hyperlinks Activate PHP Script
I have a sitemap page with approximately 20 different pages listed on it, 10 of which are password protected, 10 of which are not. I want the 10 non password protected page links on my site map page to execute the following PHP command when they are clicked: <? session_unregister("CustomerID"); session_unregister("UserID"); session_unregister("FirstName"); session_unregister("AccessLevel"); session_destroy(); ?> How do I integrate this PHP function into the following code so that, when one of these links is clicked, the PHP script above is executed: <li class="content_text"><a href="index.php">Home Page</a> - The home page for #*$! </li> <li class="content_text"><a href="login.php">Login Page</a> - The login page for #*$! </li> However, I don't want the PHP script to execute when a user clicks one of these links:
Set The Selected Text For Option Box Of A Menu..
Having major issues with this simple task, and I cant work out why its not doing as it should/expected. Basically, ive got a drop down box with the added bit of php: <select name="title" id="title"> <?php if($_SESSION['title'] != "") { echo '<option value="'. $_SESSION['title'] .'" selected="selected"></option>' } else { echo "<option value="" selected></option>"; } ?> <option>Mr</option> <option>Mrs</option> <option>Miss</option> <option>Ms</option> <option>Dr</option> </select> Basically, if the user submits a form, the title is stored in the session, this works fine, and then when returned to the page, the value should be filled in. Yet, when they return to the page, there value they selected is not shown in this box, instead, theres just a gap. The source seems correct, and this is whats shown: <select name="title" id="title"> <option value="Mr" selected="selected"></option>
Html Pre-selected List Box Scrolled
Is it possible to have a list box with a pre-selected value automatically scrolled to that value when the form is loaded? i.e. if the size of the list box is 3, and the 4th value is pre-selected, I want the list box to appear starting at the 4th value in the form.
Showing What Was Selected In Drop-down Menu
I'm trying to create a form where the user inputs data, i validate it with php, and if some of the input is missing or invalid then i print out errors with the form filled out with the information they entered/selected previously so they can change/add to it. The problem I'm having is setting my drop down menus to be selected when the form is returned instead of returning their original state. The menu I have is named A ($A). Here's an example of what I'm doing that isn't working: PHP Code:
Keeping Select Option Value Selected
I'm trying to learn how to keep the value "selected" once a form is set to read the values and then f-write them (all within a loop). The part that's giving me a problem is the part which would return the value of the form as "selected". PHP Code:
Display Selected Record That Has Been Passed To URL
I have a page which can list all records from a table in my local database. For each record that is displayed there is link next to it. When the link is pressed another page opens up and the ID (automated primary key in my table) of the record selected is passed to the URL. So now the URL looks something like this: http://localhost/Webpages/newpage.php?recordID=3 How do I display the details of the record that has been selected on this new page?
|