Jump to content

form submission missing data


tgribble

Recommended Posts

hello

 

this form is not submitting all the 'jeweltype' data to the mysql db. help please

 

=============================================

 

 

 

 

 

html>

<head>

<title>Upload an image to a database</title>

</head>

<body>

 

  <table>

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

      <tr>

        <td>Upload <input type="file" name="imagefile"><br />

Jewelery Type:

            <select>

<?php

$sql="SELECT jeweltype FROM jeweltypes";

            $result =mysql_query($sql);

            while ($data=mysql_fetch_assoc($result))

{

            ?>

            <option value="jeweltype"><?php echo $data['jeweltype'] ?></option>

            <?php

}

?>

            </select>

            <br />

       

      <input type="submit" name="xsubmit" value="Upload">

      </td>

      </tr>

      <tr>

      <td>Latest Image</td>

      </tr>

      <tr>

      <td><img src="?pic=1"></td>

      </tr>

    </form>

 

</table>

 

</body>

</html>

 

==========================================

with this query

==========================================

 

<html> 

<head><title>Your Page Title</title></head> 

<body> 

<?php 

include ('connect.php');

@mysql_select_db($database) or die( "Unable to select database"); 

$result = mysql_query( "SELECT jeweltype FROM jewel_images" ) 

or die("SELECT Error: ".mysql_error()); 

$num_rows = mysql_num_rows($result); 

print "There are $num_rows records.<P>"; 

print "<table width=400 border=1>\n"; 

while ($get_info = mysql_fetch_row($result)){ 

print "<tr>\n"; 

foreach ($get_info as $field) 

print "\t<td><font face=arial size=1/>$field</font></td>\n"; 

print "</tr>\n"; 

print "</table>\n"; 

?> 

</body> 

</html>

 

Link to comment
https://forums.phpfreaks.com/topic/236283-form-submission-missing-data/
Share on other sites

  {

              ?>

              <option value="jeweltype"><?php echo $data['jeweltype'] ?></option>

              <?php

      }

 

 

Should be

 

  {

              ?>

              <option value="<?php echo $data['jeweltype'] ?>"><?php echo $data['jeweltype'] ?></option>

              <?php

      }

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.