$_GET Problem!!!Anyone Help??
Posted: Wed Jan 05, 2005 6:39 pm
I've created a record website and in a section the admin user can edit a particuler vinyl they are looking at. Using the $_GET it should get the catno for the item and take you to an edit form where it retrieves the details of that vinyl for editing from the catno. Well i know the form works as i've entered the catno myself into the url. the problem is that i have to enter it in it doesn't get passed from the previous page. i'v looked ages to see where and y it don't get passed but can't see it any one help??
url that i get from link selection is:
should get
full code for edit_form_php page:
and the script the catno should get passed from is:
url that i get from link selection is:
Code: Select all
http://localhost/edit_vinyl_form.php?catno=Code: Select all
http://localhost/edit_vinyl_form.php?catno=100000full code for edit_form_php page:
Code: Select all
<?php
session_start();
require_once('display_vinyl_form.php');
$catno = $_GET['cat_no'];
if ($vinyl = get_vinyl_details($catno))
{
display_vinyl_form($vinyl);
}
else
echo 'Could not retrieve vinyl details.<br />';
?>and the script the catno should get passed from is:
Code: Select all
<?php
require_once('useful_stock_fns.php');
function display_vinyl_details($vinyl)
{
if(!is_array($vinyl))
{
echo 'No Details on this record Currently Available<br />';
return;
}
{
?>
<table bgcolor="#7b9815" border="0" bordercolor="FFFFFF">
<tr>
<td><font color="#7b9815" size="2" face="Arial, Helvetica, sans-serif">
<tr>
<td align="center">
<b>Vinyl Details</b>
</td>
</td>
<tr>
<tr>
<td bgcolor="#44802c">
<b>Artist:</b>
</td>
</tr>
<tr>
<td >
<?
}
echo $vinyl['artist_id'];
echo '</td>';
echo '</tr>';
echo '<tr>';
{
?>
<td bgcolor="#44802c">
<?
}
echo '<b>Title:</b> ';
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td>';
echo $vinyl['title'];
echo '</td>';
echo '</tr>';
echo '<tr>';
{
?>
<td bgcolor="#44802c">
<?
}
echo '<b>Our Price:</b> ';
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td>';
echo number_format($vinyl['price'], 2);
echo '</td>';
echo '</tr>';
echo '<tr>';
{
?>
<td bgcolor="#44802c">
<?
}
echo '<b>Description:</b> ';
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td>';
echo $vinyl['vinyl_information'];
echo '</td></tr></table>';
if ($_SESSION['rank'] == '2'){
?>
<table><tr><td><a href ="edit_vinyl_form.php?catno=".$vinyl['cat_no'])>Edit</a></td>
<td> </td>
<td><a href = "admin.php">Adminstration Menu</a></td>
<td> </td>
<td><a href = "stock.php?action=newrecord">Add Vinyl</a></td>
<td> </td>
<td><a href = "logout.php">Logout</a></td>
</tr>
<?
}
if ($_SESSION['rank'] == '1'){
echo '<table><tr><td><a href =>Add to Basket</a></td>
<td> </td>
<td><a href = >View Basket</a></td>
<td> </td>
<td><a href = >Continue Shopping</a></td>
<td> </td>
<td><a href = >Save Changes</a></td>
<td> </td>
<td><a href = "logout.php">Logout</a></td>
</tr>';
}
echo '<table>';
}
session_start();
require('page.inc');
require_once('shopping_cart_fns.php');
$vinylform = new Page();
$vinylform -> Display();
display_main_menu();
$catno = $_GET['cat_no'];
$vinyl = get_vinyl_details($catno);
display_vinyl_details($vinyl);
do_html_footer();
?>