Go Back   SitePoint Forums > Forum Index > Program Your Site > PHP
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old May 31, 2006, 14:37   #1
safeasfcuk
SitePoint Guru
 
safeasfcuk's Avatar
 
Join Date: Jan 2006
Location: UK (SWANSEA)
Posts: 655
how do i do this?

iv got this far with a bit of help from you guys but am stuck again

what im trying to do is be able to select which table the user wants to edit the fields for iv managed to get a list off all the data in each table but now im stuck on how to bring up a page with all the data in that field in it?

understand?

this is the code for displaying the list of items in each table.

how would i be able to show the content of that field?

Code:
else if (isset($_GET['edit'])) {
?>

<form action="" method=post enctype=multipart/form-data>

 <p>Select the product range you want to edit<br>
 <input type=radio name=table value=clarice checked=checked> Clarice Cliff<br />
<input type=radio name=table value=welsh> Welsh Gaudy<br />
<input type=radio name=table value=deco> Deco Antique<br />
<input type=radio name=table value=royal> Royal Doulton<br />
<input type=Submit name="submit" value=Edit>
<?php

 if ($_POST['submit']) {
 $source=$_POST['table'];

include ("dbconnect.php");

$sql="SELECT * FROM " . mysql_real_escape_string($_POST['table']);

$result=mysql_query($sql) or die(mysql_error()); 
?>

<table width=293 border=1>
  <tr>
    <td width=171>Product Name</td>
    <td width=106>Update</td>
  </tr>
  <tr>
  <?php
  
while($rows=mysql_fetch_array($result)){
?>
	<td><?php echo $rows['name']; ?></td>
<td align="center"><a href="index.php?id=<? echo $rows['id']; ?>">update</a></td>
  </tr>
  <?php
  }
	?>
</table>
<?php
mysql_close();
}
}
safeasfcuk is offline   Reply With Quote
 

Bookmarks

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Sponsored Links
 
Forum Jump


All times are GMT -7. The time now is 03:16.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved