I'm not sure if or how I need to use ajax in this situation. I have a php page (info.php) written mostly in html that is a form with at least 20 inputs, select menus and a variable number of dynamic inputs. From main.php I'm passing data to it by info.php?user=Jayden
which will grab the person's data from a database then populate the form fields if the user exists. I know I need to use javascript at some point to create the ajax request, but I don't know how or where. I know I need ajax to parse the database output and to fill in the form fields, but since the request was already made to php to load the user, am I supposed to make it again to the same page? Am I supposed to create the javascript using php and then trigger that somehow?
Edit: I forgot to mention I'm trying to use the same page (info.php) for creating new tries as well as fetching and displaying old entries.
question from:
https://stackoverflow.com/questions/65851323/trying-to-populate-form-fields-using-php-how-do-i-get-it-to-use-ajax 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…