473,511 Members | 15,630 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

passing a query to another page

92 New Member
is it possible to pass a query to another page?

for example,

page1.php
Expand|Select|Wrap|Line Numbers
  1. <form method='post' action='page2.php'>
  2. <?
  3.      $query = mysql_query("SELECT * FROM tblProducts");
  4.      ....
  5. ?>
  6.  
  7. <input type='submit' onclick='page2.php'>
  8.  
  9. </form>
  10.  
page2.php
Expand|Select|Wrap|Line Numbers
  1. <?
  2.      $newquery = $_POST['query'];
  3.  
  4.     include("connect_db.php")
  5.  
  6.      $result = mysql_query($newquery);
  7. ?>
  8.  
Oct 30 '07 #1
4 2836
pritipshah
11 New Member
If you want to user $_POST['query'] in page2.php then you have to have hidden variable in first file named query and in that variable you have to set your value(i.e sql query)

Regards,
Priti
Oct 30 '07 #2
backups2007
92 New Member
If you want to user $_POST['query'] in page2.php then you have to have hidden variable in first file named query and in that variable you have to set your value(i.e sql query)

Regards,
Priti
Thank you for your reply.

Do you have any other suggestions aside from my post? Are there any other ways to pass queries?
Oct 30 '07 #3
pritipshah
11 New Member
Hi backups2007,

As per mine this is the only safe way to use query values from last page. you can't pass to in get value as it displays on toolbar and not the right way of codeing too.

My suggesion to you is better to write a query on the same page where you want to run it because if lost connection or other tech problem will occure while redirecting the page then it will end to error.

Regards,
Priti
Oct 30 '07 #4
backups2007
92 New Member
Hi backups2007,

As per mine this is the only safe way to use query values from last page. you can't pass to in get value as it displays on toolbar and not the right way of codeing too.

My suggesion to you is better to write a query on the same page where you want to run it because if lost connection or other tech problem will occure while redirecting the page then it will end to error.

Regards,
Priti
Here's the thing, the reason why I am asking about passing queries to another page is because I need to use it for a part of the system that I'm developing. It is for an exporting to excel option of my system. I want to use only one file that other pages can call to export contents from the database.
Oct 30 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
7769
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains:...
5
2978
by: UnixUser | last post by:
Is there a way to pass a blob field from a database to another php script file as a parameter? The blob contains a jpeg image.
3
16928
by: WGW | last post by:
Though I am a novice to MS SQL server (2000 I believe), I can do almost! everything I need. Maybe not efficiently, but usefully. However, I have a problem -- a complex query problem... I can...
1
6870
by: Eric | last post by:
Hello, I am trying to come up with the best way to pass large amounts of data from page to page, namely a data table. The user needs to enter data into a form in one page and confirm it on...
3
2565
by: Steven J. Reed | last post by:
I must be missing something, because this should be easy to do. After the user has selected several options on a page, I do a database query which returns a few records that I want to pass to...
2
1562
by: lacombpcs | last post by:
I have a web app that searches a database and returns a datagrid table. the user inputs the search terms into a textbox. The user selects the info he wants and it sends him to a 2nd page, after...
3
1969
by: James Robertson | last post by:
I am new to the ASP and VB thing so be kind. Question I have is that I have created an ASPX web site to use as an E-Mail page. But I want to use this for a lot of users. Can I create the link on...
6
2336
by: JackM | last post by:
I have a multiple select input in a form that's being populated by a row from my database as such: <input type=\"checkbox\" name=\"subm\" value=\"$row\"> That part is working fine as I can check...
1
1805
by: rfr | last post by:
I have a need to use a single version of a Visitor Response Feedback Form on numerous HTML documents. Rather than have numerous versions of this, one on each HTML document, it makes more sense to...
4
2806
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi, just wondering if anyone can provide a brief example of passing parameters from one webpage to another, C# VS2005? I need to pass several selected values of dropdown list boxes to a secondary...
0
7138
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7353
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7418
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7075
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7508
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3212
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
446
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.