bossman Posted July 11, 2010 Share Posted July 11, 2010 Hi all, I am currently in the process of building an admin for a directory website we are currently working on.. here is a link to the admin... http://mediagenius.biz/test/hairlossdir/index_test_admin.php as you can see, there are 3 basic functions. Add, edit, and delete...universal among content management systems. The problem i am having, is that i stopped coding for a short while, and i need a point in the right direction regarding the edit and delete functions... so far the add function works fine. here is the code for the add... <? require("db_connect.php"); $new_name = $_POST['name']; $new_contact = $_POST['contact']; $new_streetaddress = $_POST['streetaddress']; $new_city = $_POST['city']; $new_state = $_POST['state']; $new_zipcode = $_POST['zipcode']; $new_country = $_POST['country']; $new_phonenumber = $_POST['phonenumber']; $new_email = $_POST['email']; $new_website = $_POST['website']; //query to insert files and info into database $query = "INSERT INTO hair_loss_clients (name, contact_name, street_address, city, state, zipcode, country, phone_number, email, website) VALUES ('$new_name', '$new_contact', '$new_streetaddress', '$new_city', '$new_state', '$new_zipcode', '$new_country', '$new_phonenumber', '$new_email', '$new_website' )"; $result=mysql_query($query); mysql_close($link); header("Location: http://mediagenius.biz/test/hairlossdir/index_test_admin.php"); ?> when i click the 'edit' button, i want it to pull in all the information into the text fields based on the id. I have done this before, but im not positive how to put the code together... i know that in the 'edit' link, i will have to pass the $id so that it knows which information to pull into the text fields...once i do that i know what to do... any help is appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/207396-admin-question-regarding-edit-and-delete-function/ Share on other sites More sharing options...
joel24 Posted July 11, 2010 Share Posted July 11, 2010 pass them with $_GET - listing the ID in the URL for the edit page to read. i.e. <a href='editPage.php?editID=<?php echo $theID; ?>'>Edit</a> and then on the edit page $id = $_GET['editID']; Quote Link to comment https://forums.phpfreaks.com/topic/207396-admin-question-regarding-edit-and-delete-function/#findComment-1084338 Share on other sites More sharing options...
bossman Posted July 11, 2010 Author Share Posted July 11, 2010 thats what i thought but i just needed the confirmation, i knew i was on the right track, THANK YOU!! Quote Link to comment https://forums.phpfreaks.com/topic/207396-admin-question-regarding-edit-and-delete-function/#findComment-1084342 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.