hyster Posted June 21, 2011 Share Posted June 21, 2011 is it possable to put a $var inside the url in a header refresh? tried header( 'refresh:0; url=index.php?mess=add&$get['part']' ); header( 'refresh:0; url=index.php?mess=add&<?php $get['part'] ?>' ); im using the header as part of a if statment and depending on which is used depeds on what the url i want. full if statment (headers not complete in the below code) if ($_GET['instr'] == 'min'){ echo $count = $_GET['qty'] - 1; $sql1="UPDATE vega_parts SET qty='$count' WHERE part='{$_GET['part']}'"; $result1=mysql_query($sql1); if($result1){ header( 'refresh:0; url=index.php?mess=rem' ); } else { echo "ERROR"; } }elseif($_GET['instr'] == 'plus'){ echo $count = $_GET['qty'] + 1; $sql1="UPDATE vega_parts SET qty='$count' WHERE part='{$_GET['part']}'"; $result1=mysql_query($sql1); if($result1){ header( 'refresh:0; url=index.php?mess=add&' ); } else { echo "ERROR"; } }else{ echo "Error"; } Link to comment https://forums.phpfreaks.com/topic/239978-header-refresh/ Share on other sites More sharing options...
trq Posted June 21, 2011 Share Posted June 21, 2011 Of course it it, but variables are not interpolated within single quotes. Link to comment https://forums.phpfreaks.com/topic/239978-header-refresh/#findComment-1232696 Share on other sites More sharing options...
hyster Posted June 21, 2011 Author Share Posted June 21, 2011 thanks again thorpe. made me look again at var types in case any1 else has the same problem header( "refresh:0; url=index.php?mess=add&part1={$_GET["part"]}" ); Link to comment https://forums.phpfreaks.com/topic/239978-header-refresh/#findComment-1232720 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.