Link to home
Start Free TrialLog in
Avatar of MrTV
MrTVFlag for Thailand

asked on

php go to next page

echo "<meta http-equiv=\"refresh\" content=\"0;url=presalefromS6.php/\" />\n";

How can i correct this code  such as

http://127.0.0.1/asian/connections/presalefromS5.php/presalefromS6.php/ 
it should go to
http://127.0.0.1/asian/connections/presalefromS6.php
Avatar of ludofulop
ludofulop

echo "<meta http-equiv=\"refresh\" content=\"0;url=/asian/connections/presalefromS6.php/\" />\n";

_or_ : why are you using slash after the file name (.php/) ? remove it from everywhere, and then you can use

echo "<meta http-equiv=\"refresh\" content=\"0;url=presalefromS6.php\" />\n";
you should remove the slash at the end of filename as given below
echo "<meta http-equiv=\"refresh\" content=\"0;url=presalefromS6.php\" />\n";
Hello Expert,

This should work.

echo "<meta http-equiv=\"refresh\" content=\"0;url=http://127.0.0.1/asian/connections/presalefromS6.php\" />\n";

Try:



$URL = 'http://127.0.0.1/asian/connections/presalefromS6.php';
echo '<meta http-equiv="refresh" content="0;'.$URL.'" />'."\n";

Open in new window

Avatar of MrTV

ASKER

Hi  ludofulop, pg-expert,ThiyagarajRa, VanHackman

I try yor suggestion but it go to
http://127.0.0.1/asian/connections/presalefromS5.php/presalefromS6.php/ 
but on http://127.0.0.1/asian/connections/presalefromS4.php

echo "<meta http-equiv=\"refresh\" content=\"0;url=presalefromS6.php/\" />\n";  it work

If i use

http://127.0.0.1/asian/connections/   

it mean i cannot change it to another computer  and directory much fix
ok, so again:

why are you using slash after the file name (.php/) ? remove it from everywhere, and then you can use

echo "<meta http-equiv=\"refresh\" content=\"0;url=presalefromS6.php\" />\n";
Avatar of MrTV

ASKER

Hi  ludofulop

It go to http://127.0.0.1/asian/connections/presalefromS5.php/presalefromS6.php

I put your suggestion online 107
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php 
session_start();
require_once('../Connections/aoldatabase.php'); 
mysql_select_db($database_aoldatabase, $aoldatabase);
$vat = 7 ;
$invoiceno =  $_SESSION['invoiceno']; 
if (isset($_POST['invoiceType'])) 
{
$invoicetype = $_POST['invoiceType'] ;
if ($invoicetype == 'i') 
{
		$query_slelectPresell = "SELECT presell.refid, presell.productcode, presell.qutiy, presell.price,presell.qutiy*presell.price, presell.productname		FROM presell where presell.refid = $invoiceno ORDER BY `presell`.`timestamp` ASC";
		$slelectPresell = mysql_query($query_slelectPresell, $aoldatabase) or die(mysql_error());
		$row_slelectPresell = mysql_fetch_assoc($slelectPresell);
		$totalRows_slelectPresell = mysql_num_rows($slelectPresell);
		?>
      
		 <table width="906" height="121" border="1">
			<tr>
				<td width="80" height="37"></td>
				<td width="136">CODE</td>
				<td width="108">NAME</td>
				 <td width="108">Quantity</td>
				 <td width="108">Uprice</td>
				<td width="160">Total</td>
				 
			</tr>
			 <?php 
				$totqutiy = 0  ;
				$toPay = 0  ;
				$noorder = 0  ;

			 do { ?>
			<tr>
				<?php $totqutiy = $totqutiy+$row_slelectPresell['qutiy']  ;
				$toPay = $toPay+$row_slelectPresell['presell.qutiy*presell.price']  ;
				$noorder = $noorder + 1 ;
       			?>
 		    <td height="32"><?php echo $noorder ; ?></td>
     		<td><?php echo $row_slelectPresell['productcode']; ?></td>
     		<td><?php echo  substr($row_slelectPresell['productname'], 0, 30); ?></td>
    		<td><?php echo $row_slelectPresell['qutiy']; ?></td>
    		<td align="right"><?php echo  number_format($row_slelectPresell['price'], 2, '.', ','); ?></td>
     		<td align="right"><?php echo  number_format($row_slelectPresell['presell.qutiy*presell.price'], 2, '.', ',');   $row_slelectPresell['presell.qutiy*presell.price']; ?></td>
    		
   			</tr>
   			<?php } while ($row_slelectPresell = mysql_fetch_assoc($slelectPresell)); ?>
    		<tr>
    		<td width="80" height="42"></td>
    		<td width="136">&nbsp;</td>
     		<td width="108">&nbsp;</td>
     		<td width="108"><?php echo $totqutiy; ?></td>
     		<td width="108">total </td>
     		<td width="160" align="right"><?php echo number_format($toPay/1.07 , 2, '.', ',') ;
     		$beforevat = number_format($toPay/1.07 , 2, '.', ''); 
     		$beforevatin = str_replace(",","",$beforevat);
     		
     		?></td>
    		
  			 </tr>
  			 <tr>
    		 <td width="80" height="42"></td>
    		 <td width="136">&nbsp;</td>
     		 <td width="108">&nbsp;</td>
     		 <td width="108">&nbsp;</td>
     		<td width="108">VAT </td>
     		<td width="160" align="right"><?php echo number_format(($toPay - $beforevat) , 2, '.', ',')  ;

     		$vatcost = number_format(($toPay - $beforevat) , 2, '.', ',') ; 
     		$vatcostin = str_replace(",","",$vatcost);
     		?></td>
    		
  			 </tr>
  			 <tr>
    		 <td width="80" height="42"></td>
    		 <td width="136">&nbsp;</td>
     		<td width="108">&nbsp;</td>
     		<td width="108">&nbsp;</td>
     		<td width="108">Grand total </td>
     		<td width="160" align="right"><?php echo number_format($toPay, 2, '.', ',')  ; 
     		 $grandtotal = number_format($toPay, 2, '.', ',')  ; 
     		 $grandtotalin = str_replace(",","",$grandtotal );  ?></td>
    		
  			 </tr>
  			 
			 </table>


				<?php
				echo " test $beforevatin   s  $vatcostin  ss  $grandtotalin  " ;
//				$query_salehead  = "UPDATE `sale` SET `total`= $beforevat, `vatinbill`= $vatcost , `grandtotal`= $grandtotal , `invoicetype`= 'i'  WHERE (`preselRef`='$invoiceno'  )  " ;
//				$salehead = mysql_query($query_salehead, $aoldatabase) or die(mysql_error());
				$query_salehead  = "UPDATE `sale` SET `total`= $beforevatin, `vatinbill`= $vatcostin , `grandtotal`= $grandtotalin , `invoicetype`= 'i'  WHERE `preselRef`= $invoiceno   " ;
                $salehead = mysql_query($query_salehead, $aoldatabase) or die(mysql_error());
				
				
				
				mysql_free_result($slelectPresell);
               echo "<meta http-equiv=\"refresh\" content=\"0;url=presalefromS6.php\" />\n";
			

// invoice ==  i
}

if ($invoicetype == 'r') 
{
 	
		$query_slelectPresell = "SELECT presell.refid, presell.productcode, presell.qutiy, presell.price,presell.qutiy*presell.price, presell.productname		FROM presell where presell.refid = $invoiceno ORDER BY `presell`.`timestamp` ASC";
		$slelectPresell = mysql_query($query_slelectPresell, $aoldatabase) or die(mysql_error());
		$row_slelectPresell = mysql_fetch_assoc($slelectPresell);
		$totalRows_slelectPresell = mysql_num_rows($slelectPresell);
		?>
      
		 <table width="906" height="121" border="1">
			<tr>
				<td width="80" height="37"></td>
				<td width="136">CODE</td>
				<td width="108">NAME</td>
				 <td width="108">Quantity</td>
				 <td width="108">Uprice</td>
				<td width="160">Total</td>
				 
			</tr>
			 <?php 
				$totqutiy = 0  ;
				$toPay = 0  ;
				$noorder = 0  ;

			 do { ?>
			<tr>
				<?php $totqutiy = $totqutiy+$row_slelectPresell['qutiy']  ;
				$toPay = $toPay+$row_slelectPresell['presell.qutiy*presell.price']  ;
				$noorder = $noorder + 1 ;
       			?>
 		    <td height="32"><?php echo $noorder ; ?></td>
     		<td><?php echo $row_slelectPresell['productcode']; ?></td>
     		<td><?php echo  substr($row_slelectPresell['productname'], 0, 30); ?></td>
    		<td><?php echo $row_slelectPresell['qutiy']; ?></td>
    		<td align="right"><?php echo  number_format($row_slelectPresell['price'], 2, '.', ','); ?></td>
     		<td align="right"><?php echo  number_format($row_slelectPresell['presell.qutiy*presell.price'], 2, '.', ',');   $row_slelectPresell['presell.qutiy*presell.price']; ?></td>
    		
   			</tr>
   			<?php } while ($row_slelectPresell = mysql_fetch_assoc($slelectPresell)); ?>
    		<tr>
    		<td width="80" height="42"></td>
    		<td width="136">&nbsp;</td>
     		<td width="108">&nbsp;</td>
     		<td width="108"><?php echo $totqutiy; ?></td>
     		<td width="108">total </td>
     		<td width="160" align="right"><?php echo number_format($toPay, 2, '.', ',') ;
     		$beforevat = number_format($toPay, 2, '.', ','); ?></td>
    		
  			 </tr>
  			 <tr>
    		 <td width="80" height="42"></td>
    		 <td width="136">&nbsp;</td>
     		 <td width="108">&nbsp;</td>
     		 <td width="108">&nbsp;</td>
     		<td width="108">VAT </td>
     		<td width="160" align="right"><?php echo number_format($toPay, 2, '.', ',')  ;

     		$vatcost = number_format($toPay, 2, '.', ',')  ; ?></td>
    		
  			 </tr>
  			 <tr>
    		 <td width="80" height="42"></td>
    		 <td width="136">&nbsp;</td>
     		<td width="108">&nbsp;</td>
     		<td width="108">&nbsp;</td>
     		<td width="108">Grand total </td>
     		<td width="160" align="right"><?php echo number_format($toPay, 2, '.', ',')  ; 
     		 $grandtotal = number_format($toPay, 2, '.', ',')  ; ?></td>
    		
  			 </tr>
  			 
			 </table>


				<?php
				$query_salehead  = "UPDATE `sale` SET `total`= $beforevat, `vatinbill`= $vatcost , `grandtotal`= $grandtotal , `invoicetype`= 'r'  WHERE (`preselRef`=$invoiceno )  " ;
				$salehead = mysql_query($query_salehead, $aoldatabase) or die(mysql_error());
				mysql_free_result($slelectPresell);
// invoice ==  r
}

if ($invoicetype == 'd')
 {
		$query_slelectPresell = "SELECT presell.refid, presell.productcode, presell.qutiy, presell.price,presell.qutiy*presell.price, presell.productname		FROM presell where presell.refid = $invoiceno ORDER BY `presell`.`timestamp` ASC";
		$slelectPresell = mysql_query($query_slelectPresell, $aoldatabase) or die(mysql_error());
		$row_slelectPresell = mysql_fetch_assoc($slelectPresell);
		$totalRows_slelectPresell = mysql_num_rows($slelectPresell);
		?>
      
		 <table width="906" height="121" border="1">
			<tr>
				<td width="80" height="37"></td>
				<td width="136">CODE</td>
				<td width="108">NAME</td>
				 <td width="108">Quantity</td>
				 <td width="108">Uprice</td>
				<td width="160">Total</td>
				 
			</tr>
			 <?php 
				$totqutiy = 0  ;
				$toPay = 0  ;
				$noorder = 0  ;

			 do { ?>
			<tr>
				<?php $totqutiy = $totqutiy+$row_slelectPresell['qutiy']  ;
				$toPay = $toPay+$row_slelectPresell['presell.qutiy*presell.price']  ;
				$noorder = $noorder + 1 ;
       			?>
 		    <td height="32"><?php echo $noorder ; ?></td>
     		<td><?php echo $row_slelectPresell['productcode']; ?></td>
     		<td><?php echo  substr($row_slelectPresell['productname'], 0, 30); ?></td>
    		<td><?php echo $row_slelectPresell['qutiy']; ?></td>
    		<td align="right"><?php echo  number_format($row_slelectPresell['price'], 2, '.', ','); ?></td>
     		<td align="right"><?php echo  number_format($row_slelectPresell['presell.qutiy*presell.price'], 2, '.', ',');   $row_slelectPresell['presell.qutiy*presell.price']; ?></td>
    		
   			</tr>
   			<?php } while ($row_slelectPresell = mysql_fetch_assoc($slelectPresell)); ?>
    		<tr>
    		<td width="80" height="42"></td>
    		<td width="136">&nbsp;</td>
     		<td width="108">&nbsp;</td>
     		<td width="108"><?php echo $totqutiy; ?></td>
     		<td width="108">total </td>
     		<td width="160" align="right"><?php echo number_format($toPay, 2, '.', ',') ;
     		$beforevat = number_format($toPay, 2, '.', ','); ?></td>
    		
  			 </tr>
  			 <tr>
    		 <td width="80" height="42"></td>
    		 <td width="136">&nbsp;</td>
     		 <td width="108">&nbsp;</td>
     		 <td width="108">&nbsp;</td>
     		<td width="108">VAT </td>
     		<td width="160" align="right"><?php echo number_format($toPay, 2, '.', ',')  ;

     		$vatcost = number_format($toPay, 2, '.', ',')  ; ?></td>
    		
  			 </tr>
  			 <tr>
    		 <td width="80" height="42"></td>
    		 <td width="136">&nbsp;</td>
     		<td width="108">&nbsp;</td>
     		<td width="108">&nbsp;</td>
     		<td width="108">Grand total </td>
     		<td width="160" align="right"><?php echo number_format($toPay, 2, '.', ',')  ; 
     		 $grandtotal = number_format($toPay, 2, '.', ',')  ; ?></td>
    		
  			 </tr>
  			 
			 </table>


				<?php
				$query_salehead  = "UPDATE `sale` SET `total`= $beforevat, `vatinbill`= $vatcost , `grandtotal`= $grandtotal , `invoicetype`= 'd'  WHERE (`preselRef`= '$invoiceno' )  " ;
				$salehead = mysql_query($query_salehead, $aoldatabase) or die(mysql_error());
				mysql_free_result($slelectPresell);
// invoice ==  d
}
}

?>

<form id="form1" name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
  <p>
    <label>
      <input type="radio" name="invoiceType" value="i" id="invoiceType_0" />
      Invoice</label>
    <br />
    <label>
      <input type="radio" name="invoiceType" value="r" id="invoiceType_1" />
      receipt</label>
    <br />
    <label>
      <input type="radio" name="invoiceType" value="d" id="invoiceType_2" />
      delivery note</label>
    <br /><input name="InvoiceType" type="submit" value="InvoiceType" />
  </p>
</form>
</body>
</html>

Open in new window

url.PNG
okay, put this to your line #107:

echo "<meta http-equiv=\"refresh\" content=\"0;url=../presalefromS6.php\" />\n";
ASKER CERTIFIED SOLUTION
Avatar of ludofulop
ludofulop

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MrTV

ASKER

GHi ludofulop

It is work pleas exlain
explanation:
you are on this URL:
http://127.0.0.1/asian/connections/presalefromS5.php/presalefromS6.php/ 
if you need to get here:
http://127.0.0.1/asian/connections/presalefromS6.php
then you need to read file from the parent directory (that means ../ )
If you try to read file without ../, it goes to the same directory, as you are actually in (presalesfromS5.php/)

i think this is clear enough