Jump to content

Trouble with Updating table with form


scmeeker

Recommended Posts

I'm having trouble with the form updating.  It seems I have all this code right but its still not updating the table.

I have a form set up that pulls the information that's already in the table and then it can be edited (hence the need for updating) but when the update button is clicked, nothing is updated or changed.

 

Now I'm working with session variables and wondering if they're being passed when the update button is clicked.

 

I'm also wondering if I can make the "<form action="artist_profile_update.php" method="post" name="update">" PHP code to pass the SESSION variable? 

 

Here is the form:

 

<form action="artist_profile_update.php" method="post" name="update">

<br />
<span class="titles">A bit about you:</span><br />
<span class="smallfont">update info </span><br />
<p> <textarea name="bio" rows=10 cols=90><?php echo $display_block = "$item_bio" ?></textarea></p>
<br />
<span class="titles">artists</span><br />
<span class="smallfont">update info</span><br />
<p> <textarea name="other_artists" rows=10 cols=90><?php echo $display_block = "$item_other_artists" ?></textarea></p>
<br />
<br />
<input type="submit" name="Submit" value="update">
</form>

 

Here is the "form action file" artist_profile_update.php: ( I would also like to redirect this back to the original page.)

 

<?php 
mysql_connect("localhost", "", "", "sgallery") or die(mysql_error());

mysql_select_db("sgallery") or die(mysql_error());

$item_bio = mysql_real_escape_string($_POST['bio']);;
$item_other_artists = mysql_real_escape_string($_POST['other_artists']);



$sql="UPDATE store SET bio='$item_bio', other_artists='$item_other_artists' WHERE username = '".$_SESSION["username"]."'";

if (!mysql_query($sql))

  {

  die('Error: ' . mysql_error());

  }  

?>

 

Any suggestions??  I'm really stuck on this one.  Thanks!

 

Link to comment
https://forums.phpfreaks.com/topic/206312-trouble-with-updating-table-with-form/
Share on other sites

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.