Passing Variables from an html form through three php pages
Moderator: General Moderators
-
dschuckman
- Forum Newbie
- Posts: 5
- Joined: Tue Sep 02, 2003 3:59 pm
Passing Variables from an html form through three php pages
Hello
I am trying to pass information that is submitted on a html generated form through three php pages and then submit the information into a mysql database.
I am able to capture the information in the first php page with \
<?php $variable = $_POST['passed_variable'] ?>
but I dont know how to pass to the next page. Any help would be greatly appreciated.
David
I am trying to pass information that is submitted on a html generated form through three php pages and then submit the information into a mysql database.
I am able to capture the information in the first php page with \
<?php $variable = $_POST['passed_variable'] ?>
but I dont know how to pass to the next page. Any help would be greatly appreciated.
David
-
dschuckman
- Forum Newbie
- Posts: 5
- Joined: Tue Sep 02, 2003 3:59 pm
Whats happening is I have designed a bandwidth testing page. And the members have to fill out a form before they start. There are three pages that occur through out the testing then it finally submits all results and the information entered by the user to a mysql database.
If i were using perl I would just include a bunch of hidden tags as I went through.
If i were using perl I would just include a bunch of hidden tags as I went through.
umm.. if you're using php, and it can only remember what it picks up on each page, and perl is the same way, why not use the same solution?
you can't grab variables that aren't there, likewise you can't remember upon a pageload what's not there.
you have two things that you can do
1: put them into hidden variables (post or get)
2: put them into cookies
well there is always just making it one page
you can't grab variables that aren't there, likewise you can't remember upon a pageload what's not there.
you have two things that you can do
1: put them into hidden variables (post or get)
2: put them into cookies
well there is always just making it one page
-
dschuckman
- Forum Newbie
- Posts: 5
- Joined: Tue Sep 02, 2003 3:59 pm
to make a form automatically submit, put this javascript at the end of your page (before the </body> tag
don't forget to change form1 to the name of YOUR form.
Mark
Code: Select all
<script language="javascript">
form1.submit();
</script>Mark
Last edited by JayBird on Wed Sep 03, 2003 5:29 am, edited 1 time in total.
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
-
dschuckman
- Forum Newbie
- Posts: 5
- Joined: Tue Sep 02, 2003 3:59 pm
<?php include_once("config.inc.php"); ?>
<html>
<head>
<title><?php echo $isp_name; ?> - Bandwidth Meter</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV="Expires" CONTENT="Fri, Jun 12 1981 08:20:00 GMT">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<link rel="stylesheet" href="style.css">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0"
marginwidth="0" marginheight="0">
<center>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><?php echo $header; ?></td>
</tr>
</table>
<table border=0 cellpadding=0 cellspacing=0>
<tr>
<td><br><br><br><br><br><br><font size=+1>
Conducting bandwidth tests...
</font></td>
</tr>
</table>
<script>
<!--
time = new Date();
starttime = time.getTime();
// -->
</script>
<?php
$data_file = "payload.bin";
$fd = fopen ($data_file, "rb");
if (isset($_GET['kbps'])) {
$test_kbytes = ($_GET['kbps'] /
* 10; //set the download to take 10 seconds
if ($test_kbytes > 3000) {
$test_kbytes = 3000;
}
} else {
$test_kbytes = $default_kbyte_test_size;
}
$bob = $_POST['customer'];
$contents = fread ($fd, $test_kbytes * 1024);
echo "<!-- $contents -->";
fclose ($fd);
?>
<script>
<!--
time = new Date();
endtime = time.getTime();
if (endtime == starttime)
{downloadtime = 0
}
else
{downloadtime = (endtime - starttime)/1000;
}
kbytes_of_data = <?php echo $test_kbytes; ?>;
linespeed = kbytes_of_data/downloadtime;
kbps = (Math.round((linespeed*8)*10*1.024))/10;
<?php
$nexturl = "results.php?kbps=' + kbps + '&downloadtime=' + downloadtime + '&KB=' + kbytes_of_data + '&recorded=1";
?>
nextpage='<?php echo $nexturl; ?>';
document.location.href=nextpage
// -->
</script>
<center>
<form name="form1"action="http://192.168.1.126/intranet/bandwidth ... esults.php" method="POST">
<input type = "hidden" name = "customer" value = "<?php echo $customer = $_POST['customer']; ?>"><?php echo $customer; ?>
nextpage='<?php echo $nexturl; ?>';
</form>
<script language="javascript">
form1.submit();
</script>
</body>
</html>
here is the actual script any thoughts on passing both the cuncatination and the hidden items?
<html>
<head>
<title><?php echo $isp_name; ?> - Bandwidth Meter</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV="Expires" CONTENT="Fri, Jun 12 1981 08:20:00 GMT">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<link rel="stylesheet" href="style.css">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0"
marginwidth="0" marginheight="0">
<center>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><?php echo $header; ?></td>
</tr>
</table>
<table border=0 cellpadding=0 cellspacing=0>
<tr>
<td><br><br><br><br><br><br><font size=+1>
Conducting bandwidth tests...
</font></td>
</tr>
</table>
<script>
<!--
time = new Date();
starttime = time.getTime();
// -->
</script>
<?php
$data_file = "payload.bin";
$fd = fopen ($data_file, "rb");
if (isset($_GET['kbps'])) {
$test_kbytes = ($_GET['kbps'] /
if ($test_kbytes > 3000) {
$test_kbytes = 3000;
}
} else {
$test_kbytes = $default_kbyte_test_size;
}
$bob = $_POST['customer'];
$contents = fread ($fd, $test_kbytes * 1024);
echo "<!-- $contents -->";
fclose ($fd);
?>
<script>
<!--
time = new Date();
endtime = time.getTime();
if (endtime == starttime)
{downloadtime = 0
}
else
{downloadtime = (endtime - starttime)/1000;
}
kbytes_of_data = <?php echo $test_kbytes; ?>;
linespeed = kbytes_of_data/downloadtime;
kbps = (Math.round((linespeed*8)*10*1.024))/10;
<?php
$nexturl = "results.php?kbps=' + kbps + '&downloadtime=' + downloadtime + '&KB=' + kbytes_of_data + '&recorded=1";
?>
nextpage='<?php echo $nexturl; ?>';
document.location.href=nextpage
// -->
</script>
<center>
<form name="form1"action="http://192.168.1.126/intranet/bandwidth ... esults.php" method="POST">
<input type = "hidden" name = "customer" value = "<?php echo $customer = $_POST['customer']; ?>"><?php echo $customer; ?>
nextpage='<?php echo $nexturl; ?>';
</form>
<script language="javascript">
form1.submit();
</script>
</body>
</html>
here is the actual script any thoughts on passing both the cuncatination and the hidden items?
somethin like this.. if you are passing arrays those will have to be broken out as well..
Code: Select all
foreach ($_POST as $key => $val){
print"<input type="hidden" name="{$key}" value="{$val}">";
}-
dschuckman
- Forum Newbie
- Posts: 5
- Joined: Tue Sep 02, 2003 3:59 pm
Does it look like I am getting any closer?
<script>
<!--
time = new Date();
endtime = time.getTime();
if (endtime == starttime)
{downloadtime = 0
}
else
{downloadtime = (endtime - starttime)/1000;
}
kbytes_of_data = <?php echo $test_kbytes; ?>;
linespeed = kbytes_of_data/downloadtime;
kbps = (Math.round((linespeed*8)*10*1.024))/10;
<?php echo $kbps = "kbps"; ?>
// -->
</script>
<center>
<form name="form1"action="http://192.168.1.126/intranet/bandwidth ... esults.php" method="POST">
<input type = "hidden" name = "customer" value = "<?php echo $customer = $_POST['customer']; ?>"><?php echo $customer; ?>
<input type = "hidden" name = "kbps" value = "<?php echo $kbps; ?>"><?php echo $kbps; ?>
<input type = "hidden" name = "downloadtime" value = "<?php echo $downloadtime; ?>"><?php echo $downloadtime; ?>
<input type = "hidden" name = "KB" value = kbytes_of_data><?php echo $KB; ?>
<input type = "hidden" name = "recorded" value = "<?php echo $recorded; ?>"><?php echo $recorded; ?>
</form>
</body>
</html>
<script>
<!--
time = new Date();
endtime = time.getTime();
if (endtime == starttime)
{downloadtime = 0
}
else
{downloadtime = (endtime - starttime)/1000;
}
kbytes_of_data = <?php echo $test_kbytes; ?>;
linespeed = kbytes_of_data/downloadtime;
kbps = (Math.round((linespeed*8)*10*1.024))/10;
<?php echo $kbps = "kbps"; ?>
// -->
</script>
<center>
<form name="form1"action="http://192.168.1.126/intranet/bandwidth ... esults.php" method="POST">
<input type = "hidden" name = "customer" value = "<?php echo $customer = $_POST['customer']; ?>"><?php echo $customer; ?>
<input type = "hidden" name = "kbps" value = "<?php echo $kbps; ?>"><?php echo $kbps; ?>
<input type = "hidden" name = "downloadtime" value = "<?php echo $downloadtime; ?>"><?php echo $downloadtime; ?>
<input type = "hidden" name = "KB" value = kbytes_of_data><?php echo $KB; ?>
<input type = "hidden" name = "recorded" value = "<?php echo $recorded; ?>"><?php echo $recorded; ?>
</form>
</body>
</html>