Rino Posted September 22, 2014 Share Posted September 22, 2014 Hai Folks, Please help me in this situation, Actually my case is bit complicated i have a list of few movies.please check the attached file. If we click on each movies ,i want to direct into next page describing details of that clicked movie (review,image,syopsis,time).can you help me to write code following is the code for showing movie list. <?php $movienames=''; //connecting to databse : using 4 values $con=mysqli_connect("localhost","rino","7eL8axn749QQMBzC","project"); // checking:if 4 values are true , show error:if its false if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } // if its true:select values from appropriate table $result=mysqli_query($con,"SELECT * FROM movies"); // if in table fetch it. $row_cnt = mysqli_num_rows($result); if($row_cnt>0) { while($rino = mysqli_fetch_array($result)) { $movienames .= $rino['name'] ."<br>"; } I created tables in database,movies,details etc. nameid of movies table is same as nameid of details. Quote Link to comment https://forums.phpfreaks.com/topic/291213-redirect-into-different-page/ Share on other sites More sharing options...
cyberRobot Posted September 22, 2014 Share Posted September 22, 2014 So where are you stuck? It looks like your next step is to make the movie titles clickable. To do that, you can surround each title with an anchor tag. The anchor tag would lead to the movie details page. For that page to know which link was clicked, you can add a GET variable containing the movie ID. For example: $movienames .= "<a href='details.php?view={$rino['nameid']}'>{$rino['name']}</a><br>"; Once the links are in place, you can retrieve the GET variable on the movie details page with: $_GET['view'] Of course you can change the variable name to whatever you want. It just needs to match the name used in the anchor tag. Quote Link to comment https://forums.phpfreaks.com/topic/291213-redirect-into-different-page/#findComment-1491789 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.