-1

I have a html form where I take all the user data and then insert/edit in the database. Then I also have a search button which shows all the available entries in the database. Problem is, when I click on a particular entry,I want all it's data in the form..in an editable format..how can I do it?? I tried storing all data in session variables and then redirecting it to the main page containing the form then assigning session variables to respective form field,but it's not working (as it says undefined when you first load the page).

https://i.stack.imgur.com/usyUf.png this image shows the error when I first load the form...all help appreciated!

PS- I did use session_start() at the beginning!

Gargi
  • 41
  • 1
  • 8
  • I would like to help but I can't see that error, nor your code. Could you please upload something for us to work with? See: https://stackoverflow.com/help/mcve – KIKO Software Jul 14 '18 at 05:53
  • Show your code first what you have done . All you have to do is create an on click event and take the id of the particular record clicked . Then using JQuery read the database for that particular id and populate the form with the values and set session . – PHP Web Jul 14 '18 at 06:44
  • I have file #1- the actual form (which has a search button)..when the search button is clicked, it goes to file #2..here it displays all names in the database..when you click on some particular name..it goes to file #3..here I retrieve all information about that name..Now, I want all this information to be displayed in that form..so that I can edit it there.. Is it clear now? – Gargi Jul 14 '18 at 07:37
  • Possible duplicate of [PHP: "Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset"](https://stackoverflow.com/questions/4261133/php-notice-undefined-variable-notice-undefined-index-and-notice-undef) – CBroe Jul 14 '18 at 14:24
  • @CBroe...It is a similar issue..but not completely same – Gargi Jul 14 '18 at 16:59

1 Answers1

0

All you have to do is put the database values in "value" attribute of input form.
e.g.

<input type="text" name="User" value="<?php echo $User;?">

Here, $User is a variable which stores the User Name retrieved from Database.

Pang
  • 9,564
  • 146
  • 81
  • 122