Face problem in UPDATE

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Fri Jul 05, 2013 7:42 am

Face problem in UPDATE

Postby veronicatham » Fri Jul 05, 2013 7:52 am

Please help me . I want to create a page that allow user to search customer information by customer ID and show the information in text box.and it also allow user to edit the information in the text box and update it.

I had done search but i can't do UPDATE.
i need someone to help :help:

Code: Select all


<form action="update3.php" name="custRegister" method="post">

search:<input type="text" name="search" />
<input type="submit" name='submit' value='search' />
<input type="submit" name="update"  value="update"/>

<br /><br />

$dbc = mysqli_connect('localhost', 'root', 'abc123', 'gksport') or die('Error connecting to MySQL server.');
if (isset($_POST['search']))

$query ="SELECT * from customer WHERE C_ID LIKE '%$search%' ";

$result = mysqli_query($dbc, $query)or die('Error querying database.');
      echo "There is no result";
while($row = mysqli_fetch_array($result))
   echo '<form action=update3.php method=post>';
   echo ' ID:' .'<input type="text" name="ID" value="'.$ID.' "\n" />';
   echo ' Name:' .'<input type="text" name="name" value=" '.$name.' "\n" />';
   echo ' IC:' .'<input type="text" name="IC" value=" '.$IC .' "\n" />';
   echo ' Date of Birth:' .'<input type="text" name="birthday" value=" '.$birthday.' "\n" />';
   echo ' Address:' .'<input type="text" name="address" value=" '.$address.' "\n" />';
   echo ' Postcode:' .'<input type="text" name="postcode" value=" '.$postcode.' "\n" />';
   echo ' City:' .'<input type="text" name="city" value=" '.$city.' "\n" />';
   echo ' State:' .'<input type="text" name="state" value=" '.$state.' "\n" />';
   echo ' Phone:' .'<input type="text" name="phone" value=" '.$phone.' "\n" />';
   echo ' Group:' .'<input type="text" name="group" value=" '.$group.' "\n" />';
   echo ' User ID:' .'<input type="text" name="userID" value=" '.$userID .' "\n" />';
   echo ' Password:' .'<input type="text" name="password" value=" '.$password .' "\n" />';
   echo '<input type="hidden" name="hidden" value="'.$IC.' "\n" />';
   echo '</form>';


php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: Face problem in UPDATE

Postby johnj » Fri Jul 05, 2013 8:12 pm

For update:
1). write a php script that will receive the data from the text box when the user submits the form
2). write a update sql using the data received from the form. Make sure you know which record to update
3). Once the update is successful, go back to the search page or some other page

Return to “PHP coding => General”

Who is online

Users browsing this forum: caslas and 3 guests