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
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')";

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.