473,665 Members | 2,827 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to save data and at the same time redirect to another page with the data in php

35 New Member
hi i just wanna know if it is possible to save data in mysql and at the same time redirect it to another page with the data in php..(note: i know how to save the data but i can't find a way to drag that data to another page)
May 3 '12 #1
4 2017
johny10151981
1,059 Top Contributor
follow this example below:
Expand|Select|Wrap|Line Numbers
  1. $eample_data='something';
  2. /*
  3. statements to save data;
  4.  
  5. */
  6.  
  7. header("Location: destination.php?example_data=".$eample_data);
  8.  
May 3 '12 #2
ehpratah
35 New Member
hi johny thanks for the rply but can u be more specific im still just starting to learn php and most of it i still dont know..uhm where am i going to put this code? this is may code for saving..thanks



<?php
$rnum=$_GET['txtrnum'];
$pday=$_GET['txtpday'];
$pmonth=$_GET['txtpmonth'];
$phr=$_GET['txtphr'];
$pmin =$_GET['txtpmin'];
$rday =$_GET['txtrday'];
$rmonth =$_GET['txtrmonth'];
$rhr =$_GET['txtrhr'];
$rmin =$_GET['txtrmin'];
$origin =$_GET['txtorigin'];
$destination =$_GET['txtdestination '];
$vehicle =$_GET['txtvehicle'];
$fname =$_GET['txtfname'];
$lname =$_GET['txtlname'];
$email =$_GET['txtemail'];
$contact =$_GET['txtcontact'];
$address =$_GET['txtaddress'];
$zip =$_GET['txtzip'];
$city =$_GET['txtcity'];
$country =$_GET['txtcountry'];
$rate=$_GET['txtrate'];


$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';

$conn = mysql_connect($ dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');

$dbname = 'msic';
mysql_select_db ($dbname);




$sql="INSERT INTO sd (Rnum, Pickday, Pickmonth, Pickhour, Pickmin, Rday, Rmonth, Rhour, Rmin, Origin, Destination, Vehicle, Fname, Lname, Email, Contact, Address, Zip, City, Country, Rate)
VALUES ('".$_POST['txtrnum']."','".$_POS T['txtpday']."','".$_POS T['txtpmonth']."','".$_POS T['txtphr']."','".$_POS T['txtpmin']."','".$_POS T['txtrday']."','".$_POS T['txtrmonth']."','".$_POS T['txtrhr']."','".$_POS T['txtrmin']."', '".$_POST['txtorigin']."' , '".$_POST['txtdestination ']."', '".$_POST['txtvehicle']."', '".$_POST['txtfname']."', '".$_POST['txtlname']."', '".$_POST['txtemail']."', '".$_POST['txtcontact']."', '".$_POST['txtaddress']."', '".$_POST['txtzip']."','".$_POS T['txtcity']."', '".$_POST['txtcountry']."','".$_POS T['txtrate']."')";

if (!mysql_query($ sql,$conn))
{
die('Error: ' . mysql_error());
}
/*THIS IS THE PART THAT I WANT TO BE REDIRECTED WITH THE DATA THAT I SAVE IN MYSQL*/

header("locatio n:http://localhost/msicrevised/europcar/PaymentForm.php ");


mysql_close($co nn)

?>
May 3 '12 #3
johny10151981
1,059 Top Contributor
I was specific with my answer, read again
May 3 '12 #4
ehpratah
35 New Member
@johny10151981
okay i got it thanks..
May 3 '12 #5

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

Similar topics

8
3042
by: Matt | last post by:
I want to submit the form to the server without opening another page. When we do the following, it will submit the form data in myform to the IIS, and open page2.asp. <form name="myform" action="page2.asp" method="post"> But I don't want to open another page, I just want to submit the form data. Should I do the following?? myform.submit();
1
1232
by: Brian Kedersha | last post by:
I am receiving XML data that I would like to validate against my schema and write at the same time. Some of the data is optional, if the data in the optional elements is incorrect, I would like to write blank data to that element, and then continue validating against my schema. Any ideas? -={Brian Kedersha}=-
2
1633
by: Stu | last post by:
Hi, When I try and use Javascript to post page form data from one aspx page to another I get the error 'Unable to validate data. '. I am not trying to read the data using web controls I am trying to read using the request object (Request.Form("FieldName")). I have had this working before but get this error when trying to reproduce the page in a new project. Anyone any ideas?
1
5047
by: Darryl | last post by:
I have an Access 2003 front-end tied via ODBC to a SQL Anywhere 8 back-end. When I open a table & try to delete a record in a certain table, I get: "The Microsoft Jet database engine stopped the process because you and another user are attempting to change the same data at the same time." I encounter similar problems in queries & forms, but diagnosing straight from the table seemed simplest to me.
3
2190
by: chandrasekhar | last post by:
please help in transfering data from one page to another page which haveing data grid with chech boxes in it , when i select check boxes and click on submit button data should transfer to another page having data grid
4
2699
by: skeerthi | last post by:
Hi While writing python script using pamie tool i got this problem. In a webpage if we have more than one link(with the same name) to another page than how we can identify the link we wanted to open.
1
1846
by: Jason7899 | last post by:
hi, i looking for do a solution to upload multi images and preview them or remove them at same time without reload page like in the picture that i have annexed in this post. how can i do that? thanks a lot for your help :) http://web-are-us.com/images/ajax_send.jpg
7
6005
by: desidude | last post by:
I have a grid view with 10 columns when I click edit it need to display data in another page with the row data in editable mode and also some other columns of the tables.
0
2448
by: Anupam Jana | last post by:
Hello All, I want to redirect to some other directory page after displaying JavaScript alert message in ASP.net in a page. For that I tried bellow code in our application ~/Profile/MyProfile.aspx.cs file string redirectTo = "~/Logins/Login.aspx"; //The page I wish to redirect to. string script = "<script>"; //Begin Script tag script += "alert('" + ui_lblError.Text + "');"; //Javascript Alert...
0
8438
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8348
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8779
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8549
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7376
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5660
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4186
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1761
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.