SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Nov 2006
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php query string

    When I click on the more details link og the detail.php page the link appears to work ok, however, the id doesn't appear to attach on to the query string. The result is further_detail.php?detail_id=

    The id doesn't appear to attach on, leaving a blank page where the further details should appear.

    I'd be grateful if anyone could check if I am missing something here

    detail.php

    Code:
    echo "<a href=\"further_detail.php?detail_id=";
    echo $row['detail_id'];
    echo "\">More Details</a>";
    further_detail.php

    Code:
    $id = $_GET['detail_id'];
    
    $result=mysql_query("SELECT firstname,lastname, address1 FROM tblDetail
    WHERE detail_id = '$id'") or die(mysql_error());
    
    while($row = mysql_fetch_array( $result )) {
    echo "<table style = \"margin-top:20px;\">";	
    	echo "<tr>";
    	echo "<td>Name:</td>";
    	echo "<td>";
    	echo $row['firstname']." ".$row['lastname'];
    	echo "</td>";
    	echo "</tr>";
    	echo "<tr>";
    	echo "<td>Address:</td>";
    	echo "<td>";
    	echo $row['address1'];
    	echo "</td>";
    	echo "</tr>";
    echo "</table>";
    }

  2. #2
    SitePoint Zealot 2ndmouse's Avatar
    Join Date
    Jan 2007
    Location
    West London
    Posts
    196
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $row['detail_id'
    Has no value

    if the value is hard coded, your link works fine.

    PHP Code:
    echo "<a href=\"further_detail.php?detail_id=";
    echo 
    'a_value';
    echo 
    "\">More Details</a>"
    Are you sure that your db query and the assignment of $row are working correctly?
    Detect file changes remotely. SimpleSiteAudit is an early
    warning anti-hacker system which sends an alert on detection.

    PHP Find Orphan Files - Finds all the unreferenced files on your site.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •