deeej Posted September 15, 2006 Share Posted September 15, 2006 Hey guys hope some one can help ill try explain it as best i can.the trouble is i cannot seem to get the id= to carry across so when the user logs in it takes them back to the page they wer at before.it starts like this, >>when you are on the resteraunt page you would like to add a testimonial for,> you click add testimonial,> for example if you were on le petit blanc resteraunt it would say in the url bar add_testimonial.php?id=2 (because the id of the resteraunt you are leaving a testimonial for is id=2.)>in the add_testimonial.php page there is a little script to say if logged in continue if not to include login.php, (so the user must login before being able to leave a testimonial.>in login.php this is where i have the if and get command.>the idea is if you logged from how i just explained for it to take you back to the add_testimonial.php?id=2 page.(once oyou have logged in)>but you can also login from the home page,>for example: by clicking login on the home page, this is where the if command comes in,>if they login from the home page there would be no ?id=2 so there for i would like them to be taken to the home page when logged in.[b] This is the add_testimonial.php page.which would be displayed like this in the url pageadd_testimonial.php?id=123[/b]<?phpsession_start();if (isset ($_SESSION['loggedin']) && isset ($_SESSION['time'])){?><form method="POST" name="t1" OnSubmit="return CheckTestimonial();"><table align="center"><caption align="center" class="TitleLinks">Add your testimonial</caption><tr><td align="right">Your name: </td><td><input type="text" name="testimonial_name"></td></tr><tr><td align="right" valign="top">Testimonial: </td><td><textarea rows="5" cols="40" name="testimonial_text"></textarea></td></tr><tr><td></td><td><input type="submit" name="s1" value="Submit"></td></tr></table></form><?php}else{include ("login1.php");}?>[b]this is the code i have so far that is in the login.php page with the if get command[/b]$id = $_GET["id"];if($id != ''){header ("Location: add_testimonial.php?id=$id");exit;}else{header ('Location: index.php');exit;}exit;}[b]Also tried echoing the id but it does not seem to show in the login page i am wondering if it something to do with the if get command being in the login page and the login page being an include to the add_testimonial page.Thanks guys[/b] Link to comment https://forums.phpfreaks.com/topic/20841-trouble-with-if-and-get-command/ Share on other sites More sharing options...
deeej Posted September 15, 2006 Author Share Posted September 15, 2006 also i tried carrying the id with include login.php?id=$id but it cannot find the login page then.Thanks Link to comment https://forums.phpfreaks.com/topic/20841-trouble-with-if-and-get-command/#findComment-92393 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.