tycy Posted January 16, 2015 Share Posted January 16, 2015 Ok first of all i have this code at the final of my insert and update code. if (!mysql_query($sql,$conn)) { die('Error: ' . mysql_error($conn)); } else{ header("Location: finalmsj.php?finalmsj=".$hiwu.""); } mysql_close($conn); } In the finalmsj.php i have a part of a code.and the variables $hiwu and another 3 somewhere in page with the context. if(isset($_GET['finalmsj'])){ $finalmsj = $_GET['finalmsj']; So now how i can call the $hiwu variable thru GET,it's kind of tricki for me this $_GET and maybe now i can understand it. I looking for the internet and i try something like this but doesn't work.Always the msj is from $hiwa variable even in the link i have something different and BTW. when the insert or update is done,the msj appear and the link look like this. http://192.168.0.15:888/phone/adm/finalmsj.php?finalmsj= it suppose to be http://192.168.0.15:888/phone/adm/finalmsj.php?finalmsj=hiwa or something after equal sign ( = ) if(isset($_GET['finalmsj'])){ $finalmsj = $_GET['finalmsj']; if($finalmsj = $hiwa){ echo $hiwa; } elseif($finalmsj = $hiwu){ echo $hiwu; } elseif($finalmsj = $aboutusa){ echo $aboutusa; } elseif($finalmsj = $aboutusu){ echo $aboutusu; } } I know the above code is wrong but i can find something helpful. Thx for any help. Quote Link to comment Share on other sites More sharing options...
MiWi Posted January 16, 2015 Share Posted January 16, 2015 (edited) First of all you're using the mysql extension which is deprecated so I'd look into changing to mysqli at a minimum. That said. Code aside, from what I read. $hiwu doesn't exist when you do the header redirect. When you do the redirect you need to pass through a value for finalmsj, then on the next page take action based off of that value. For example, set header to finalmsj.php?finalmsj=somedata Then in finalmsj.php page have logic to detect if finalmsj is somedata do ... Also your if statements are wrong. if($finalmsj = $hiwa) There you would be setting $finalmsj to $hiwa. When checking if a variable matches another you'd use two == if($finalmsj == $hiwa) Edited January 16, 2015 by MiWi Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.