Jump to content

Recommended Posts

Hello everyone:

 

I'm building a php admin area right now and have a question. Right now, when I access the admin area, I'm using this code to display the information presently in the database and to also enable the user to add new information:

 

<?php while($row = mysql_fetch_array($result)){ ?><p><form><textarea><?php echo $row['news']; ?></textarea><input name="save" type="submit" value="Save" class="saveBtn" /><input name="delete" type="submit" value="Delete" class="deleteBtn" /></form><?php echo "<br /><br />"; ?>
</p><?php } ?><h2>Add Information</h2><p>If you would like to add information, please type it in the box below and click save.<br /><br /><form><textarea></textarea><input name="save" type="submit" value="Save" class="saveBtn" /></form></p>

 

I have the first textarea which displays all the information presently in the database, which is a loop, so if there is more than one row, there is a text area displayed for each row in the database. I then have "delete" and "save" buttons that are spit out for each row as well.

 

Below, I have a textarea where the user can add information into the database by typing int the box and clicking save.

 

My question is, since I'm new to mysql databases, for the first section, how do I get it to delete the displayed text and save in the same row if the user chooses to edit the present information?

 

Also, if the user simply wants to use the bottom box to add new information, how do I make it work?

 

I'm fairly familiar with PHP, but only a little with MySQL. Any help would be great appreciated. Cheers!

 

JPearson311

Link to comment
https://forums.phpfreaks.com/topic/54693-php-admin-anyone/
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.