Jump to content

how to add item to "select" in html form


aldm

Recommended Posts

Hi,

I'm building one application with HTML, CSS and PHP. In this web application, I have a form for

creating new member and form with list of members, where member should be selected from the "select" element in html form, and then informations about that member can be viewed.

How can I add member's name and surname to "select" when I'm creating him, on form for view member's profile?

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/171642-how-to-add-item-to-select-in-html-form/
Share on other sites

  • 5 weeks later...

<?php

//first you have to know really about mysql and php

//connect to your database and don't forget user session

//get your data using fetch array based on user session

//Let say that your array is being stored inside '$array'

 

$myrecordfromdatabase = $array['record_kept_in_database'];

?>

<select name="choose"><option value='check1' <?php if($myrecordfromdatabase=='check1'){

echo "SELECTED";}else{

 }>

 

hope it could give you some hints

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.