Jump to content

help_lucky

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Everything posted by help_lucky

  1. I want to download the records of the output of search criteria to excel. As the fields for search criteria are more than 20. I am submitting the form with POST method rather than GET. On click of "Download2excel", the hidden variable name1 is set to Yes. so i will check the condition in my code. Once the download is successful, I want to reset the variable. Here is a sample structure of my code. <html> <head> <?php if(trim($_POST['name1']) == 'yes') { header("Content-type: application/vnd-ms-excel"); header("Content-Disposition: attachment; filename=$filename.xls"); }else { ?> </head> <body onload="tempFn()"> <script language="javascript" type="text/javascript"> function tempFn(){ global_search.name1.value = ""; } function gs_download2xl_c() { document.getElementById('name1').value="yes"; document.global_search.submit(); } </script> <form name="global_search" id="global_search" action="test_1.php" method="POST"> <input type="text" id="name1" name="name1" /> <a class="underline" style="cursor: pointer" onclick="gs_download2xl_c();"> Download2excel </a> </form> <?php } ?> </body> </html> As i am not executing the form after posting the form, i am not able to access the variable name1 is in it. I want to reset the variable name1. I want to trigger the download, after submitting the form. As the records that are downloaded to excel should obey input search criteria. Please suggest me a better procedure.
  2. Hello Everyone, I need to upload excel sheet in to the database. Which i am doing with the query SELECT * INTO temp FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\Dokumente und Einstellungen\l.varada\Desktop\BA-Control.xls', 'SELECT * FROM [qry_BA_Controlling (Report)$]') Here C:\Dokumente und Einstellungen\l.varada\Desktop\BA-Control.xls is the path from where the excel file needs to be fetched. qry_BA_Controlling (Report) is the name of the worksheet. So on executing the query, a table with name 'temp' is created. With records that are populated from excel. Now here i have a date field in excel. sometimes the values of this field are not uploaded properly into the temp table. The values for this date field are set to NULL eventhough they have values in EXCEL. I have modified my query so, Insert into temp Select * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\Dokumente und Einstellungen\l.varada\Desktop\BA-Control.xls', HDR=YES', 'SELECT * FROM [qry_BA_Controlling (Report)$]') Here temp is an existing table, i have defined the date type of the field [creation date] to varchar and uploaded the excel. Then i used **convert** to change the datatype to the correct format.. update temp set [Creation date] = CONVERT (varchar,[Creation date],101) Even now it is populating NULL values..Or this conversion needs to be done while uploading. if so, please let me know or suggest me an alternative approach..
  3. Today i have tried with a different input. surprisingly i am not able to upload with the last working excel file too.
  4. Hi All, I have a requirement in which, i upload excel sheets to sql server database. The business logic is executed and display as reports in php. It is working fine till yesterday. Today i tried to upload excel files. It is throwing an error message stating:- The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" could not find "installable ISAM." Query that i used in the stored procedure:- EXEC('SELECT * INTO temp FROM OPENROWSET(''Microsoft.Jet.OLEDB.4.0'', ''Excel 8.0;Database=' + @ba_bm_status + ''',' + '''SELECT * FROM [qry_BA_Controlling (Report)$]'')'); @ba_bm_status - i/p parameter of srored procedure qry_BA_Controlling (Report) - worksheet name webserver used:- IIS, connection is through odbc. I have no information about this error. Can you please help me in solving the same.
  5. Yes both have the values. As i am submitting the same form onclick of both the checkboxes. onclick --> checkbox A .---> trigger form with name "form_name" --> Fetch the values from php for 1st set of fields. onclick --> checkbox B .---> trigger form with name "form_name" --> Fetch the values from php for 2nd set of fields. My question is, as it is triggering the same form onclick of checkbox A&B. Is there any way how i can indentify which(Checkbox A or checkbox B) is checked. from $_POST, i will get the values of the checkboxes, but not which one is clicked, for this form to get submitted.
  6. Thanku for ur reply. Requirement:- I have a form, in which i have 2 checkboxes. Onclick of a checkbox, values for first set textboxes(that are in the same form) needs to be fetched automatically. onclick of another checkbox the value of select tag and textarea needs to be filled. My approach:- I have created 2 checkboxes and onlclick of each of the checkboxes i am submittting the same form. From where i can fetch the values using php code. print_r($_post) will return Array(checkbox1=>primary checkbox2=>secondary). The value of first and second checkboxes. But i will not able to find which is checked by this click. It just returns values of the checkboxes. But does not give me the info, onclick of which checkbox the form got submitted. So, The question is how will i come to know, if the form got submitted, by click of first checkbox or second. Hope i am clear in explaining the questions and waiting for replies.
  7. I don't know how to copy table data from one server -> database -> table TO other sever -> database -> table. If it is with in the same server and different databases, i have used the following SELECT * INTO DB1..TBL1 FROM DB2..TBL1 (to copy with table structure and data) INSERT INTO DB1..TBL1(F1, F2) SELECT F1, F2 FROM DB2..TBL1 (copy only data) Now my question is copy the data from SERVER1 --> DB1--> TBL1 to SERVER2 --> DB2 -->TBL2
  8. 1 I have a requirement in which, i need to upload an excel file into SQL Server database. It is working well till this point. But sometimes i am getting excel file in such a way, that the first 2 rows and columns are empty rows. That is not even fixed every time. so the format of the table after upload is not as expected. It is assigning F1, F2 as column names for the table in SQL Server. It varies from file to file. I want to program it in such away so that the user can enter the row number and the column number from where the actual data is starting. So that while upload it should from line 3 and column 2. I don't know how to specify that row and column while uploading. Please help me to solve the same.
  9. Hello Everyone, I have 2 checkboxes in a form and onclick of these. Once the checkbox is checked, only the fields that are relevant to the checkbox are displayed, with default values in it and to fetch the default values i need to trigger php code. So i can't perform the operation once the whole form is submitted. As the client i am working for does not support AJAX. I can't go for it. So i have written onclick = document.formName.submit(); Now it is triggering the same page and i am able to write the code. I am not able to differentiate which checkbox is checked. I don't want to use the procedure of:- calling javascript and then storing the value of the checkbox in a variable and making this variable as invisible. I would like to write something like document.formName.submit('checkbox1'). So that i should be able to handle the value of this or i dont know. Please suggest me an alternative method or better approach.
  10. That's good idea. It's quite elaborative...Thanku for your time and for detailed response. I will try this way.
  11. Hi all, I want to print a page from another page. I have a master page with links to other page. When I click "print," it should print the another page. The function window.print() is printing only the active page. So on click print i am opening a new window. In the onload event of the target page i have used <body onload="window.focus();window.print();window.close ();"> Eventhough it's working, at the same time the window is also popping up behind the printer set up screen. when i click print or cancel the window gets closed automatically. i don't want the window to pop up. Do suggest me if there is any other alternative way.. Thanks for your help.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.