Jump to content

php passing value


nanuna

Recommended Posts

hi..

i'm have some problem here..i don't know what happen or what's wrong with my coding... it's already brings the value i need..but..it wont go to the next page,, could you tell me what happen? i'm totally new with php..n i hope you all could help me.. thnks!

 

 

 

here the code..

 

admin_proses_editBayaran.php

Link to comment
https://forums.phpfreaks.com/topic/278740-php-passing-value/
Share on other sites

sorry.. here is the code

 

<?php
 
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="catering"; // Database name
$tbl_name="bayarantempahan"; // Table name
 
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
 
 
$idTempahan =  $_GET['idTempahan'];
//$idTempahan = (isset($_GET['idTempahan']) ? $_GET['idTempahan'] : null);
 
$result = mysql_query("SELECT bayaranKedua FROM bayarantempahan WHERE idTempahan='$idTempahan'");
$count=mysql_num_rows($result);
$row=mysql_fetch_array($result);
 
$bayaranKedua = $row['bayaranKedua'];
 
if($bayaranKedua==0){
echo "<script>alert('Teruskan?')</script>";
echo "<script>window.location.href='admin_addBayaran.php?idTempahan='+$_GET[idTempahan]'';</script>";
exit();
}
else {
echo "<script>alert('Teruskan?')</script>";
echo "<script>window.location.href='admin_addBayaran2.php?idTempahan='+$idTempahan'';</script>";
exit();
}
?>
 
<?php
// close connection
mysql_close();
?>
Link to comment
https://forums.phpfreaks.com/topic/278740-php-passing-value/#findComment-1433927
Share on other sites

For redirect to another page use:

header("Location:admin_addBayaran2.php?idTempahan=$idTempahan");

Maybe you need to adjust the peace of code I've put. Try it.

 

You need to put it instead of:

echo "<script>window.location.href='admin_addBayaran2.php?idTempahan='+$idTempahan'';</script>";

Link to comment
https://forums.phpfreaks.com/topic/278740-php-passing-value/#findComment-1433934
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.