• We just launched and are currently in beta. Join us as we build and grow the community.

Updating Using Radio Button - Checkbox and Dropdown List

Fuck1nRetarded

Social Media Trend Analyst
Divine
F Rep
0
0
0
Rep
0
F Vouches
0
0
0
Vouches
0
Posts
142
Likes
48
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 400 XP
In this tutorial I will you will learn about updates and how to save data in Mysql , display the information from MySQL, and most important How to update radio button, Checkbox and dropdown list in PHP and MySQL.This simple updating using radio button, checkbox and dropdown list in PHP and MySQL. This project creates a registration query through the form and automatically connect in the mysql to create database. And you can update and delete the data even if you are not in the database. I will show you the example code below.

Sample Code

Registration Form
  1. <script type="text/javascript">
  2. function deletes(id)
  3. {
  4. if(confirm('Sure To Remove This Record ?'))
  5. {
  6. window.location.href='delete.php?id='+id;
  7. }
  8. }
  9. </script>
  10. <h1 align="center">Update - Registration Form</h1>
  11. <?php
  12. include

    (

    'config.php'

    )

    ;

  13. extract

    (

    $_POST

    )

    ;
  14. if

    (

    isset

    (

    $save

    )

    )
  15. {
  16. $que

    =

    mysql_query

    (

    "select email from student where email='$email

    '"

    )

    ;
  17. $row

    =

    mysql_num_rows

    (

    $que

    )

    ;
  18. if

    (

    $row

    )
  19. {
  20. echo

    "<font color='red'>This email id is alredy exists</font>"

    ;
  21. }
  22. else
  23. {
  24. $hob

    =

    implode

    (

    ","

    ,

    $arr

    )

    ;
  25. mysql_query

    (

    "insert into student values('','$n

    ','$e

    ','$m

    ','$gen

    ','$hob

    ','$cou

    ',now())"

    )

    ;
  26. echo

    "<font color='blue'>Records saved</font>"

    ;
  27. }
  28. }
  29. echo

    "<table border='1'>"

    ;
  30. echo

    "<tr><th>Student_Id</th><th>Name</th><th>Email</th><th>Mobile Number</th><th>Gender</th><th>Hobbies</th><th>Country</th><th>Registered Date</th><th>Delete</th><th>Update</th></tr>"

    ;
  31. $que

    =

    mysql_query

    (

    "select * from student"

    )

    ;
  32. while

    (

    $obj

    =

    mysql_fetch_object

    (

    $que

    )

    )
  33. {
  34. echo

    "<tr>"

    ;
  35. echo

    "<td>"

    .

    $obj

    ->

    id

    .

    "</td>"

    ;
  36. echo

    "<td>"

    .

    $obj

    ->

    name

    .

    "</td>"

    ;
  37. echo

    "<td>"

    .

    $obj

    ->

    email

    .

    "</td>"

    ;
  38. echo

    "<td>"

    .

    $obj

    ->

    mob

    .

    "</td>"

    ;
  39. echo

    "<td>"

    .

    $obj

    ->

    gender

    .

    "</td>"

    ;
  40. echo

    "<td>"

    .

    $obj

    ->

    hobbies

    .

    "</td>"

    ;
  41. echo

    "<td>"

    .

    $obj

    ->

    country

    .

    "</td>"

    ;
  42. echo

    "<td>"

    .

    $obj

    ->

    regDate

    .

    "</td>"

    ;
  43. ?>
  44. <td><a href="javascript:deletes(<?php

    echo

    $obj

    ->

    id

    ;

    ?>

    )">Delete</a></td>
  45. <?php
  46. echo

    "<td><a href='update.php?eid=$obj->email

    '>Update</a> &nbsp;</td>"

    ;

  47. echo

    "</tr>"

    ;
  48. }
  49. echo

    "</table>"

    ;
  50. ?>

Update - Registration Form

Database Configuration
  1. <?php
  2. error_reporting

    (

    1

    )

    ;
  3. $con

    =

    mysql_connect

    (

    "localhost"

    ,

    "root"

    ,

    ""

    )

    or die

    (

    mysql_error

    (

    )

    )

    ;
  4. mysql_select_db

    (

    "radiodown"

    ,

    $con

    )

    ;
  5. ?>

sadsadww.png


For more tutorials just visit this website @www.sourcecodester.com and don't forget to Like and Share. Enjoy Coding.


Download
You must upgrade your account or reply in the thread to view hidden text.
 

452,292

323,340

323,349

Top