elentz Posted December 9, 2007 Share Posted December 9, 2007 I have a simple 1 field page that I want to take the input from that field and pass it to a variable on another page. Can someone point me to a tutorial or show me some code to get this done? Thanks Alot! Link to comment https://forums.phpfreaks.com/topic/80916-how-to-pass-info-from-one-page-to-another/ Share on other sites More sharing options...
mkosmosports Posted December 9, 2007 Share Posted December 9, 2007 Below is a tutorial on passing form data to php pages. http://www.w3schools.com/php/php_forms.asp Link to comment https://forums.phpfreaks.com/topic/80916-how-to-pass-info-from-one-page-to-another/#findComment-410503 Share on other sites More sharing options...
elentz Posted December 10, 2007 Author Share Posted December 10, 2007 Thanks for the link I got the first page to pass the variable, I tested it to a test page just like the tutorial. But, I can't get the post to go to the variable I need for my query. h4></h4> <form action=/customstuff/tickets/tutorial/ticket.php method=post> Ticket #:<input type=text name="ticketid"> </form> Then here is part of the query I need the post to go to . ' Inner Join vtiger_accountshipads ON vtiger_account.accountid = vtiger_accountshipads.accountaddressid' . ' WHERE' . ' vtiger_troubletickets.ticketid = '\"$_POST["ticketid"]"\''; I am sure it is a simple syntax problem but I just don't understand some of the intricies here. Can some one help me? Link to comment https://forums.phpfreaks.com/topic/80916-how-to-pass-info-from-one-page-to-another/#findComment-410610 Share on other sites More sharing options...
teng84 Posted December 10, 2007 Share Posted December 10, 2007 can you post a little more of that code and please always mention what the prob? Link to comment https://forums.phpfreaks.com/topic/80916-how-to-pass-info-from-one-page-to-another/#findComment-410612 Share on other sites More sharing options...
elentz Posted December 10, 2007 Author Share Posted December 10, 2007 Sorry, The problem is: I can't get the variable from the first page to the end of the query in the second page. The code I have for the first page is <title>Pricebook / Pricing Worksheet</title> <style type="text/css"> <!-- .head1 {background: #CC9933; height:32px; color: #FFFFFF; font-size: 10pt; font-weight: 500=medium; text-align: center} .sub1 {background: #C8B588; height:22px; color: #FFFFFF; font-size: 9pt; font-weight: 500=medium; text-align: center} .data1 {background: #ffffCC} .data2 {background: #ffffCC} /* End of style section. Generated by AceHTML at 16/08/03 10:14:34 */ --> </style> </head> <BODY> <H4>Trouble Ticket Print page </h4> <H4>Enter the Trouble Ticket number that you want to print.</h4> <H4>Press the Enter Key after you make the entry.</h4> <h4></h4> <form action=/customstuff/tickets/tutorial/ticket.php method=post> Ticket #:<input type=text name="ticketid"> </form> <?PHP //****************************************************** // Connection to the Database //****************************************************** $conn = mysql_connect("localhost", "admin", "9axmy425"); mysql_select_db ('vtigercrm50',$conn); //****************************************************** include ('baaGrid.php'); $querystring=$sql = 'SELECT' . ' vtiger_troubletickets.ticketid,' . ' vtiger_account.accountname,' . ' vtiger_accountshipads.ship_city,' . ' vtiger_ticketcf.cf_544' . ' FROM' . ' vtiger_account' . ' Inner Join vtiger_troubletickets ON vtiger_troubletickets.parent_id = vtiger_account.accountid' . ' Inner Join vtiger_ticketcf ON vtiger_ticketcf.ticketid = vtiger_troubletickets.ticketid' . ' Inner Join vtiger_accountshipads ON vtiger_account.accountid = vtiger_accountshipads.accountaddressid' . ' WHERE' . ' \'\' = \'\'' . ' ORDER BY' . ' vtiger_troubletickets.ticketid DESC' . ' LIMIT 20' . ' '; $grid = new baaGrid ($querystring); $grid->showErrors(); // just in case $grid->setHeadings("Ticket #,Customer,City,Type of call"); $grid->display(); ?> </BODY> </html> The second page I need the $_POST to be inserted into the where clause of the query so it picks the right record out of the tables. Here is most of the second page $sql = 'SELECT' . ' vtiger_account.accountname,' . ' vtiger_troubletickets.ticketid,' . ' vtiger_troubletickets.priority,' . ' vtiger_troubletickets.severity,' . ' vtiger_troubletickets.description,' . ' vtiger_accountscf.cf_472,' . ' vtiger_accountscf.cf_476,' . ' vtiger_ticketcf.cf_534,' . ' vtiger_ticketcf.cf_536,' . ' vtiger_ticketcf.cf_538,' . ' vtiger_ticketcf.cf_540,' . ' vtiger_accountscf.cf_464,' . ' vtiger_accountscf.cf_478,' . ' vtiger_accountscf.cf_468,' . ' vtiger_accountscf.cf_484,' . ' vtiger_accountscf.cf_486,' . ' vtiger_account.phone,' . ' vtiger_accountshipads.ship_street,' . ' vtiger_accountshipads.ship_city,' . ' vtiger_accountshipads.ship_code,' . ' vtiger_accountshipads.ship_state' . ' FROM' . ' vtiger_account' . ' Inner Join vtiger_accountscf ON vtiger_account.accountid = vtiger_accountscf.accountid' . ' Inner Join vtiger_troubletickets ON vtiger_accountscf.accountid = vtiger_troubletickets.parent_id' . ' Inner Join vtiger_ticketcf ON vtiger_ticketcf.ticketid = vtiger_troubletickets.ticketid' . ' Inner Join vtiger_accountshipads ON vtiger_account.accountid = vtiger_accountshipads.accountaddressid' . ' WHERE' . ' vtiger_troubletickets.ticketid = '\"$_POST["ticketid"]"\''; [color=red][font=Verdana]//' vtiger_troubletickets.ticketid = \'17273\''[/font][/color] The line in red is a line I used to test the rest of my code for the second page. It produces a PDF. Thanks I hope I have explained my problem. Link to comment https://forums.phpfreaks.com/topic/80916-how-to-pass-info-from-one-page-to-another/#findComment-410622 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.