Jump to content

Getting ID from the URL


slj90

Recommended Posts

The error tells me that it's line 12 (which is the line in my original post)

 

Here is the full code:

 

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php
include “connection.php”

//get id of record
$CustomerID=$_GET['id'];

// create query 
$query = "SELECT * FROM Customer WHERE CustomerID = '$CustomerID'"; 

// execute query - put the results in $result (an array) 
$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); 

//Check to see you have got at least 1 record 
if (mysql_num_rows($result) > 0) 
{
$row = mysql_fetch_array($result);

//print out record details on a form     
?> 
<form name="form1" id="form1" method="GET" action= "customerChangeDeleteAction.php"> 
<table width="100%"  border="0"> 
        <tr> 
          <td width="25%">Customer ID </td> 
          <td width="75%"><input type="hidden" name="txtID" value="<?php echo $row["CustomerID"]; ?>" /><?php echo $row["CustomerID"]; ?><font size="2"> (Field hidden as cannot change key field)</font></td> 
        </tr> 
        <tr> 
          <td>First Name</td> 
          <td><input type="text" name="txtFirst" value="<?php echo $row["Firstnames"]; ?>"/></td> 
        </tr> 
        <tr> 
          <td>Surname</td> 
          <td><input type="text" name="txtSurname"  value="<?php echo  $row["Surname"]; ?>"/></td> 
        </tr> 
        <tr> 
          <td>User Name</td> 
          <td><input type="text" name="txtUser" value="<?php echo $row["Username"]; ?>"/></td> 
        </tr> 
	<tr> 
          <td>Email</td> 
          <td><input type="text" name="txtEmail" value="<?php echo $row["Email"]; ?>"/></td> 
        </tr>
	<tr> 
          <td>Password</td> 
          <td><input type="text" name="txtPassword" value="<?php echo $row["Password"]; ?>"/></td> 
        </tr>
        <tr><td><input name="Amend" type="Submit" value="Amend" /></td><td><input name="Delete" type="Submit" value="Delete" /></td></tr> 
      </table> 
    </form> 
<?php //Otherwise no rows found 
} // end if
	else echo "No rows found"; 
    
// Close the DBMS connection 
   		mysql_close($connection); 
?> 

</body>
</html>

 

Thanks alot!

 

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.