2

I design 3 pages in html with bootstrap framework, one is i can insert data to database the second it shows subject and date of the data i inserted in database in a html table and i want the 3rd page to get data from database when i click on recorded data in table and show it in the 3rd page.

|-------|----------|--------------|
| No    |   Subject   | Date      |
|-------|----------|--------------|
|  1    |      A   |   2016       |
|-------|----------|--------------|
|  2    |      B   |   2016       |
|-------|----------|--------------|

when i click on A i want to get data about A project from Database and when i click on B i want to get details about B project in another Page from databse.

i don't have any idea how to do that with php and html.

sorry for bad English

1 Answer 1

1

Pass Project No with GET Variable and retrieve that data with that ID in 3rd page like this :

Second Page :

<tr>
    <td><?=$project->no;?></td>
    <td><?=$project->subject;?></td>
    <td><a href="localhost/3rdpage.php?id=<?=$project->no;?>">Details</a></td>
</tr>

Third Page :

$projectNo = $_GET['id'];

$stmt = $pdo->prepare('SELECT * FROM project WHERE no = ?');
$stmt->execute(array($projectNo));
$data = $stmt->fetch(PDO::FETCH_OBJ);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.