This is my edit page. I can see values in my input boxes retrieved from database. What I want to do is update those values when I click on button. Here is my code plz help

<?php

require_once ('conn.php');

$id = $_REQUEST['main_id'];
$sql = "select * from users, work,home where users.id=$id and users.home_id = home.home_id and users.work_id = ie_work.work_id";

$rs = mysqli_query($conn,$sql);
$row = mysqli_fetch_assoc($rs);

$name = $row['name'];       
$surname = $row['surname'];
$home = $row['home_adress'];
$work = $row['work_adress'];
$email = $row['email'];
$tel= $row['telephone'];
$job = $row['job_descrip'];
$dtime = $row['time_emp'];

?>
<form name="form12" id="form12" method="post">

<label>name:</label><input name="name" id="name" value="<?php echo $name; ?>"/><br>
<label>surname:</label><input name="surname" id="surname" value="<?php echo $surname; ?>"/><br>
<label>home-ad:</label><input name="home" id="home" value="<?php echo $home; ?>"/><br>
<label>work-ad:</label><input name="work" id="work" value="<?php echo $work; ?>"/><br>
<label>email:</label><input name="email" id="email" value="<?php echo $email; ?>"/><br>
<label>tel:</label><input name="tel" id="tel" value="<?php echo $tel; ?>"/><br>
<label>job_d:</label><input name="job" id="job" value="<?php echo $job; ?>"/><br>
<label>time_d:</label><input name="time" id="time" value="<?php echo $time; ?>"/>
<input type ="submit" value="edit" >

</form>

You need to send that data from form to a page. So you need to add something like this:

<form id="contactform" method="post" action="localhostmmmmmmmm.com/update.php"> 

In my case action will send all that data in that update.php
So you need to add action to your form
Then when add it you need to make update.php you will getters for all taht fields

$option="";

if(isset($_POST["option"])) {
    $option=$_POST["option"];
}

That is one example.
Then you need to create sql code to update that in DB with exact ID of the row in table.
Try to do it by yourself if you once again have problems give us a code and we will help you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.