Link to home
Start Free TrialLog in
Avatar of aprillougheed
aprillougheedFlag for United States of America

asked on

for andriv

Send me your email and I'll send you the files.

I'm getting closer.

1.  I can get form to display form to MySql data
2.  I can get the form to "accept" the form data and open a new file
3.  The first form is also writing to the database, but it isn't picking up the correct "variable"
4.  Haven't even started on "mailing" a confirm to webmaster & customer.

I think it is an array problem.

Awaiting your email address.

You're my hero!

April
Avatar of aprillougheed
aprillougheed
Flag of United States of America image

ASKER

p.s. - I'm ee@guider.com
Names and table.

1.  Table one tblLiterature - List of literature that can be selected:

 LiteratureID
 LiteratureSKU  
 LiteratureDescription  
 TypeID

2. Table two tblLiteratueRequested - tracks how many of each LiteratureSKU are ordered and when.

 RequestID  
 LiteratureSKU  
 LiteratureDescription  
 Action  
 Date  

Later to add by who - will be setting up a "member" only function with member table and username/password table. -- more points for you!! -- hopefully I'll be able to figure some of it out :)
Here is the where I'm at.

************File one***********
<html>
<head><title>Literature Request</title></head>
<body>
<?php
  $user="ag";
  $host="localhost";
  $password="";
  $database = "netafimusa_com";

  $connection = mysql_connect($host,$user,$password)
       or die ("couldn't connect to server");
  $db = mysql_select_db($database,$connection)
       or die ("Couldn't select database");

  /* Select all items from tblLiterature table */
  $query = "SELECT * FROM tblLiterature ORDER BY LiteratureDescription";        
  $result = mysql_query($query)                                
       or die ("Couldn't execute query.");

  /* Display text before form */
  echo "<div style='margin-left: .1in'>
  <h1 align='center'>Pet Catalog</h1>
  <h2 align='center'>The following animal friends are waiting for you.</h2>
   <p align='center'>Find just what you want and hurry in to the store to pick
      up your new friend.
  <p><h3>Which pet are you interested in?</h3>\n";

  /* Create form containing selection list */
  echo "<form action='AddPet.php3' method='post'>\n";        
  echo "<table cellpadding='5' border='1'>";
  $counter=1;                                                  
  while ($row = mysql_fetch_array($result))                    
  {
     extract($row);                                            
     echo "<tr><td valign='top' width='15%'>\n";
     echo "<input type='radio' name='interest'                
             value='$LiteratureSKU'\n";
     if ( $counter == 1 )                                      
     {
         echo "checked";
     }
     echo "><font size='+1'><b>$LiteratureSKU</b></font>            
          </td>
          <td>$LiteratureDescription</td>                            
          </tr>";
     $counter++;                                                
  }
  echo "</table>";
  echo "<p><input type='submit' value='Select Pet Type'>        
        </form>\n";                                            
?>
</div>
</body>
</html>

*********File2*************
<html>
<head>
<title>Add Pet</title>
</head>
<body>
Catalog:<br>
<ul>

<?php
  $user="ag";
  $host="localhost";
  $password="";
  $database = "netafimusa_com";

  $connection = mysql_connect($host,$user,$password)
       or die ("couldn't connect to server");
  $db = mysql_select_db($database,$connection)
       or die ("Couldn't select database");

// Trim the incoming data.
$Array["LiteratureSKU"] = trim ($Array["LiteratureSKU"]);
$Array["LiteratureDescription"] = trim ($Array["LiteratureDescription"]);



$label_array = array ("LiteratureDescription" => "Literature Description");

//Loop through the values
foreach ($HTTP_POST_VARS as $key => $value)

//missing curly bracket

{

     
$query = "INSERT INTO tblLiteratureRequested
(LiteratureDescription) VALUES ('{$label_array["LiteratureDescription"]}')" ;

                             

$result = mysql_query($query)
     or die ("Couldn't execute query.");



}
//Close the loop
?>
  <!-- Close your list and html -->
</ul>
</body>
</html>


ASKER CERTIFIED SOLUTION
Avatar of andriv
andriv

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yes, Andy -- Sorry I wanted to use Checkboxes for multiple select -- But I'll keep this first one as a reference.

YOU ARE AMAZING!!!

Andy - the comments you put in your answer are so helpful.

You are the best expert I've ever worked with.

Anyway I can sing your praises with EE?

April