Jump to content

redirect into different page


Rino

Recommended Posts

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.
post-172956-0-70511900-1411383113_thumb.png
nameid of movies table is same as nameid of details.

post-172956-0-56903400-1411383869_thumb.png

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.