Sorry but I am fairly new to PHP, and translating some code over from ASP. While I have done Updates from .NET and c# and ASP. And Understand the theory behind it I am struggling to find the PHP code that works. It will be a really simple concept to some of you.
So I have a list that is pulled from a MS SQL database. This is a list of all 'pages' for example. next to each one is and edit button that looks like this:
<a href="UpdatePage.php?id="><img src="images/edit.gif" width="16" height="16" alt="" border="0"></a>
The important line being:
href="UpdatePage.php?id="
I need to set a variable after the ?id=
This is mean to redirect you to the edit page where I will populate a form with data from the DB.
The code I have written for that looks like this:
<?php
$query = "SELECT PageTitle, PageText ";
$query .= "FROM Pages ";
$query .= "WHERE PageID = ";
$result = mssql_query($query);
$numRows = mssql_num_rows($result);
?>
Again missing the bit after PageID = If I set this to all it pulls through all entries, if I hardcode it with an ID it also works. What im looking for is a way for the list page to pass the update page the PageID and a way to tell the query that is needs to only retrieve that entire relating to that PageID. If that makes sense. I have looked at alot of code and can't find a decent tutorial or explanation of this relating to PHP and MSSQL. Any tips or points in the right direction would be appreciated.
After looking through I feel it should be something like:
<?php echo $PageID; ?>
$PageID = $_GET['PageID'];
AM I on the right tracks?