I have a script that combines a few different tables and in practtise allows a user to find a supplier and then submit an enquiry on this supplier. When they hit submit a table will be updated and an email will be sent. The problem I have is that the data that is output to the user is less comprehensive than the data the administrator needs to see, ie the user will see the supplierid, the services they offer etc, the administrator who reviews these enquiries or reads the email will need to see the address of the supplier, the name and relevant details etc.
This leads me onto my problem and hopefully it is easily solved. Any data that the user needs is output in html, ie the supplierid etc mentioned above. The stuff that they dont need to see is not output, however when I setup my POST array I have problems with undefined indexes from parts that are not output as html.
My script is very big so here is an example of what I am trying to achieve:
Code: Select all
//Simple select query
$query = "select * from suppliers where x = x";
$result = mysql_query($query) or die("Couldn't execute query");
//Set up rows of result set
$row = mysql_fetch_array($result, MYSQL_ASSOC);
// $title = $row ["username"];
$supplier = $row ["supplierid"];
$town = $row ["town"];
$county = $row ["county"];
$enquirydetails = $row["enquirydetails"];
if(isset($_POST['submit'])){
$supplier = $_POST ["supplierid"];
$enquirydetails = $_POST["enquirydetails"];
//now update the database, send email etc
now for the html part:
<html>
<form action="<?=$_SERVER["PHP_SELF"]?>" method="POST">
<tr><td>Please add any details or requests you would like to make:<BR> <TEXTAREA NAME="enquirydetails" value="<?php print isset($_POST["enquirydetails"]) ? $_POST["enquirydetails"] : "" ;?>"COLS=40 ROWS=6></TEXTAREA>
</td></tr>
//submit button etc etc
</html>I know I could use hidden fields in html to set these up, but isnt there an alternative to just getting the rows retirieved into a POST array?
I have a cold and probably could have explained this in a shorter time, but hey ho.
Thanks,
G