0

I have a question and I will try to explain the best way that I can

I have a table that show me names of accounts and each one of that accounts has it own information. Something like this

and I'm getting that information like this

enter image description here

On the page "verpersonagem.php" I have this: $idaccount = $_GET['accountId']; but the url comes like this ../verpersonagem.php?account= Why it's not getting the value?

Thanks in advance

2 Answers 2

1

you don't have yo use all this echo statement try this

<?php
    while ($row = mysqli_fetch_row($result))
    {
    echo '<tr>
            <th><a href="verpersonagem.php?account='. $row[0] .'"> '. $row[0] .' </a></th>
            <td>'. $row[2] .' </td>
            <td>'. $row[1] .'</td>
            <td>'. $row[3] .'</td>
            <td>'. $row[4] .'</td>
        </tr>';
    }
?>
Sign up to request clarification or add additional context in comments.

7 Comments

Okay thank you, I will change it And about my question?
is there something i miss in your question ?
how can I get the account name to from that page to another one clicking on the name of the account
in the other account you will do this if(!empty($_GET['account'])){ $accountId = $_GET['account']; } $query = "SELECT * FROM tablename WHERE accountID = '$accountId'"; $row = mysqli_query($link, $query); and complete the rest as above
I will change the original question for my code now, if you can please check it
|
1

You should insert the href into the Table its TD instead of TH

Use a for loop instead and say count(rows)

Then $i < $rows and href=example.php?id=$i

Then use $_GET['id'] And do a database query which gets all the info about the id

4 Comments

Can you explain better please?
Make a for loop in php then call the table with the tabelhead called Person then add TD with a (<a href='example.php?name=test$i'>) then in the example.php: $_GET['name']; and store that in a variable then you can do database queries with the variable
<?php // query to database that get the amount of users for($i = 0; $i < count(/* amount of users */; $i++) { echo '<tr> <th>users</th> </tr> <tr> <td><a href="example.php?name=test$i">Name $i</a></td> </tr> '; } ?> Example.php <?php $user = $_GET['name']; // now use $user to get all info about this user and display it on the page ?>
I'm sorry, I tried but I couldn't make it work The url stays like this "verpersonagem.php?ID="

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.