rukshilag Posted December 17, 2009 Share Posted December 17, 2009 Using following HTML Code please show me how to write PHP code to accept and delete the incoming data entered through the form below. from the following MySQL database and table. Database = hrms Table = Student Fields = StdNo(Number), Name(String), Address(String), Contact No(String) Student No<Input type='text' name='txtStdNo' /> <br> Name<Input type='text' name='txtName' /> <br> Address<Input type='text' name='txtAdd' /> <br> Contact No<Input type='text' name='txtTel' /> <br> <input type='submit' name='cmdDelete' value='Delete' /> <input type='submit' name='cmdRetrieve' value='Retrieve' / <input type='submit' name='cmdUpdate' value='Update' /> <input type='submit' name='cmdClose' value='Close' /> Link to comment https://forums.phpfreaks.com/topic/185466-php-code-to-accept-and-delete-incoming-data/ Share on other sites More sharing options...
nafetski Posted December 17, 2009 Share Posted December 17, 2009 TONNNNS of tutorials out there for this kind of stuff. If you're 100% new to php...start with learning the basics. Then learn - How to connect to a database - How to insert values in your database - How to remove values in your database - How to update records in your database Probably in that order. If you are still having problems, come back with some source code and I will be more than happy to help! Link to comment https://forums.phpfreaks.com/topic/185466-php-code-to-accept-and-delete-incoming-data/#findComment-979242 Share on other sites More sharing options...
rukshilag Posted December 18, 2009 Author Share Posted December 18, 2009 how is this solution?? tell me if there is another easier way than what i have done> <?php $sql = ''; // connect to the database $conn = mysql_connect('localhost', 'root', ''); // select the hrms database mysql_select_db('hrms', $conn); // check whether the form submitted by invoking the cmdDelete button if(isset($_GET['cmdDelete'])) { // sql delete statement definition $sql = "delete from Student where StdNo = " . $_GET['txtStdNo']; // check whether the form submitted by invoking the cmdUpdate button } else if(isset($_GET['cmdUpdate'])) { // sql update statement $sql = "update Student set Name = '" . $_GET['txtName'] . "', Address = '" . $_GET['txtAdd'] . "', ContactNo = '" . $_GET['txtTel'] . "' where StdNo = " . $_GET['txtStdNo']; } // execute the sql query mysql_query($sql); // close the connection mysql_close($conn); ?> Link to comment https://forums.phpfreaks.com/topic/185466-php-code-to-accept-and-delete-incoming-data/#findComment-979793 Share on other sites More sharing options...
emopoops Posted December 18, 2009 Share Posted December 18, 2009 i think what ur looking for is called mod_rewrite. i dont have time to give u the link but im sure youl rather enjoy this function. i used it once when i was reworking a tutroail and it really mae a lott of sense. perhaps u need to strighten otutthings with the mods of ur site before uget into this mod_rewrite kind of stuff just on a personal note just incase u fail at understanding my pisy Link to comment https://forums.phpfreaks.com/topic/185466-php-code-to-accept-and-delete-incoming-data/#findComment-979810 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.