Jump to content

[SOLVED] Not all data gets submitted.


EagleAmerican

Recommended Posts

Just switched hosts and now another problem with PHP. Whenever I add a parasite, the last of 5 fields doesn't get added (removal instructions). I have to edit it multiple times before it will go in. The last problem I had, register_globals was off.. is that causing this too?

index.php

 

<?php if (isset($_GET['addparasite'])): 
?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<label>Name:<br />
<textarea name="parasitename" rows="1" cols="50">
</textarea></label><br />
<label>Origin:<br />
<textarea name="parasitefrom" rows="1" cols="50">
</textarea></label><br />
<label>Genre:<br />
<textarea name="parasitegenre" rows="1" cols="50">
</textarea></label><br /
<label>Description:<br />
<textarea name="parasitedescription" rows="5" cols="50">
</textarea></label><br />
<label>Removal Info:<br />
<textarea name="parasiteremoval" rows="5" cols="50">
</textarea></label><br />
<input type="submit" value="Add" name="parasiteadd" />
</form>

 

if (isset($_POST['parasiteadd'])) {
   $parasitename = $_POST['parasitename'];
   $parasitefrom = $_POST['parasitefrom'];
   $parasitegenre = $_POST['parasitegenre'];
   $parasitedescription = $_POST['parasitedescription'];
   $parasitetechremoval = $_POST['parasiteremoval'];
   $sql = "INSERT INTO parasite SET
       parasitename='$parasitename',
       parasitefrom='$parasitefrom',
       parasitegenre='$parasitegenre',
       parasitedescription='$parasitedescription',
       parasiteremoval='$parasiteremoval'";
   if (@mysql_query($sql)) {
     echo "<p>The parasite '$parasitename' has been added.</p>";
   } else {
     echo '<p>Error adding submitted parasite: ' .
         mysql_error() . '</p>';
   }
}

 

Thanks,

Adam

Link to comment
https://forums.phpfreaks.com/topic/64354-solved-not-all-data-gets-submitted/
Share on other sites

You might try doing the query this way:

 

$sql = "INSERT INTO parasite (parasitename, parasitefrom, parasitegenre, parasitedescription, parasiteremoval) VALUES ('$parasitename', '$parasitefrom', '$parasitegenre', '$parasitedescription', '$parasiteremoval')";

 

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.