SHOW SELECTED OPTION VALUE FROM ARRAY & MySQL DATABASE USING PHP

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 พ.ย. 2024

ความคิดเห็น • 68

  • @faizanrehmani2564
    @faizanrehmani2564 2 ปีที่แล้ว

    Very very thanks brother you solve my big task in my project
    👍👍👍👍👍

    • @RaddyDev
      @RaddyDev  2 ปีที่แล้ว

      👊😉

  • @agustinavendano4918
    @agustinavendano4918 2 ปีที่แล้ว +1

    Thanks!

  • @mominadil2279
    @mominadil2279 2 ปีที่แล้ว +2

    Thank you for this video very much,
    Please, a small question, if you can help. I managed to create a table merging content from 2 tables from MySQL database. I added a drop-down list based on the users names in one column, but I'm trying to make another column autofill based on the username for example phone number.
    I'm building a form which has contents in the database in 2 separate tables, but I couldn't manage to autofill a column based on username from the other table. Both tables have linked username_id.

  • @omniversal4739
    @omniversal4739 4 ปีที่แล้ว

    I have two select dropdowns. One of which are users from the database and others are a theme which they can choose. My users being selected from the database while my themes are a simple select menu (array). After the users select their userId, they can pick a theme and the designChoice column gets updated by the theme which they have selected. I hope you understood it. I had fun playing with that.

    • @RaddyDev
      @RaddyDev  4 ปีที่แล้ว +1

      That sounds a pretty cool. Good use case I guess. Thank you for watching and I am glad that you found the video useful

  • @athithyaparamesh8251
    @athithyaparamesh8251 2 ปีที่แล้ว +1

    Exactly what I was looking for!! Thanks a lot!!

  • @mr.bekzod9989
    @mr.bekzod9989 ปีที่แล้ว

    Thank you sir you are helpful

    • @RaddyDev
      @RaddyDev  ปีที่แล้ว

      Most welcome

  • @jjosephale
    @jjosephale 4 ปีที่แล้ว +1

    Nice tutorial and easy to understand. Good Job.
    Bring some more

    • @RaddyDev
      @RaddyDev  4 ปีที่แล้ว

      Thank you! 🦍

    • @victorsolano9420
      @victorsolano9420 4 ปีที่แล้ว

      Josephale Mayehu
      Great video:
      How can I display the select statement from the DB on a jS

    • @RaddyDev
      @RaddyDev  4 ปีที่แล้ว

      @@victorsolano9420 You can use PHP inside JS like this:
      variableName = "";
      Another way you can use is to create a PHP file that does your database query and return as JSON and then maybe use JS to fetch the data and do whatever you want to do with it.

  • @karanjoshi8220
    @karanjoshi8220 4 ปีที่แล้ว +2

    Nice tutorial
    Make some more it is too helpfull

    • @RaddyDev
      @RaddyDev  4 ปีที่แล้ว

      I will do brother. Thank you for watching

  • @mkajiwala1
    @mkajiwala1 2 ปีที่แล้ว

    Hello, horw r you? It was great learning..

    • @RaddyDev
      @RaddyDev  2 ปีที่แล้ว

      I am great, thank you for asking. How are you doing? Glad that you liked the tutorial

  • @wordpressidee
    @wordpressidee 3 ปีที่แล้ว

    Thank you, this tutorial is very helpful. Will implement some of the code in my project.

    • @RaddyDev
      @RaddyDev  3 ปีที่แล้ว +2

      Sounds good to me. I am glad that you found it useful

  • @Siblingsfunmoments
    @Siblingsfunmoments 2 ปีที่แล้ว

    great tutorial

    • @RaddyDev
      @RaddyDev  2 ปีที่แล้ว

      Thank you!

  • @sqtrailer7450
    @sqtrailer7450 3 ปีที่แล้ว

    Thanks bro.......

    • @RaddyDev
      @RaddyDev  3 ปีที่แล้ว +1

      Thank you for watching, brother!

  • @homestudio7866
    @homestudio7866 2 หลายเดือนก่อน

    أنا أحبك يا رجل لقد قمت بحل مشكلة كبيرة لي، شكراً لك

  • @kelvinowusu7083
    @kelvinowusu7083 4 ปีที่แล้ว +2

    Ive got an assignment where im being asked to echo an image depending on what I select from the database list. is there anyway to do this ?

    • @RaddyDev
      @RaddyDev  4 ปีที่แล้ว +1

      If I understand correctly, you need to do something like this:
      1) Create your Database with the tables and data
      2) Create database connection with your favorite language
      3) Query the data that you need to display
      4) Display the data
      5) Close your Database Connection
      Just search for "PHP MySQL Select Data" - if you are using PHP and MySQL of course...
      I hope this helps!

    • @kelvinowusu7083
      @kelvinowusu7083 4 ปีที่แล้ว

      @@RaddyDev thanks, ive been able to query data and display it. however I want to display and image depending on what the user selects. so example if my user selects apple form the database through my web. I want to display a picture of an apple.in other words I want to link an image. I want to link an image to each selected option. in working with html and php mysql

    • @RaddyDev
      @RaddyDev  4 ปีที่แล้ว +2

      In this case, you can create a folder called images on your server and then reference the names of the images in the database.
      Let's say you have a table called fruit. In that table you might have 3 fields:
      id | name | image
      1 | apple | apple.jpg
      2 | banana | banana.jpg
      Then just like you are displaying data from the database, display the image field in an HTML image element.
      This is just an example. Obviusly change the variables...

    • @kelvinowusu7083
      @kelvinowusu7083 4 ปีที่แล้ว +1

      @@RaddyDev Thanks a lot for your help

  • @mkajiwala1
    @mkajiwala1 2 ปีที่แล้ว

    Very good

  • @AuriffYusuf
    @AuriffYusuf 2 ปีที่แล้ว

    Hi great tutorial. would it be possible to get the id associated to the list in the database to display the data without using the get and URL in the browser. Practically you would not expect a user to change the URL to obtain results. I have a database with an array with up to 12 values. on each id. I need to be able to extract values of each array associated to the id.

  • @sainikbagri8876
    @sainikbagri8876 2 ปีที่แล้ว +1

    Hi I need a solution ,
    I want to drop down selected value don't show in drop-down after submitting or store in database .. kindly make a video on it

  • @jevarnotice6999
    @jevarnotice6999 3 ปีที่แล้ว

    Hi great tutorial!. I was wondering if how to send the selected data from existing database table to a new table in the database using a post method?

    • @RaddyDev
      @RaddyDev  3 ปีที่แล้ว

      Hey, I am glad that you liked the tutorial. To send data on POST you can grab the data with the GET method and then do a MySQL query INSERT. Search for "MySQL post to database" and you will find tons of examples

  • @jeanbeaudet3249
    @jeanbeaudet3249 4 ปีที่แล้ว +3

    Hello Raddy
    Very nice tutorial.
    I have a quick question: How can you populate your dropdown directly from the mySQL database instead of using this line:
    $options = array('Comedy', 'Adventure', 'Drama', 'Crime', 'Adult', 'Horror');
    Thanks in advance and have a nice day !

    • @RaddyDev
      @RaddyDev  4 ปีที่แล้ว

      This is included in the second half of the video. Just after minute 16:00 is where I start working on it. I hope that it helps and thank you for your comment

    • @jeanbeaudet3249
      @jeanbeaudet3249 4 ปีที่แล้ว +2

      @@RaddyDev Thanks for your answer. I double checked your video and the dropdown is populated through an array at line 84 and not from mySQL data.
      How can we not manually put an array for $options and get the values from the database ?
      Thank You !

    • @RaddyDev
      @RaddyDev  4 ปีที่แล้ว +1

      Sorry my mistake. Have a look at this example on StackOverflow:
      stackoverflow.com/questions/5189662/populate-a-drop-down-box-from-a-mysql-table-in-php

    • @phiayang5952
      @phiayang5952 3 ปีที่แล้ว +1

      @@RaddyDev I have the same questions too...your video is displaying the array you pointed but not directly form data base...thanks for this info!

    • @RaddyDev
      @RaddyDev  3 ปีที่แล้ว

      @@phiayang5952 The link above has an example with a MySQL query. It's more or less the same, so you might need to try that. Thanks for the question

  • @youneshessani9195
    @youneshessani9195 ปีที่แล้ว

    hello raddy i have a question i have a dropdown and it shows the selected option value but my teacher doesnt want the selected value on screen and also in the dropdown he only wants it on the the screen when selected if you know what i mean im not great at english (i get the option values from the database)

    • @RaddyDev
      @RaddyDev  ปีที่แล้ว

      Like a radio button? The values come from the database and you use a radio buttons to select it?

  • @maliksaab9736
    @maliksaab9736 3 ปีที่แล้ว

    Nice video SIR,
    I want to display student result from database when they enter their roll no. On website.. kindly guide php code

    • @RaddyDev
      @RaddyDev  3 ปีที่แล้ว

      There are a lot of examples on and videos on this. Have a look at "Retrieve Data From MySQL" and you should get tons of results :)

  • @silviopontesx
    @silviopontesx 3 ปีที่แล้ว

    Hi
    How to show the data related to the selected option?
    Like this:
    We populate two inputs with the first values.
    And, if change any input, populate the other input with the context!

    • @RaddyDev
      @RaddyDev  3 ปีที่แล้ว

      You could do that with AJAX if you don't want the page to refresh. Just look up AJAX and MySQL and you will find tons of useful examples. There are a few on w3schools

  • @madmattermassive
    @madmattermassive 3 ปีที่แล้ว

    if you add another value in the Db will it update in the select ?

    • @RaddyDev
      @RaddyDev  3 ปีที่แล้ว

      The select options are manually stored in an array. You could add them in the database and loop thru them

  • @helmiboubaker2742
    @helmiboubaker2742 3 ปีที่แล้ว

    thx u for your work but you are missing one something . how we can get the value from that combobox when the user interact with the combo box i mean how i can know what value he pick and make action base on it !? thw again ama sorry for bad english keep going

    • @RaddyDev
      @RaddyDev  3 ปีที่แล้ว +1

      You could look up how to post a value from a drop down and that will hopefully answer your question. You can POST to another page or self post and do whatever you like with the value

  • @jonjoncandare4649
    @jonjoncandare4649 2 ปีที่แล้ว

    what if i dont use option i just want to show them by group displaying all data

  • @mkajiwala1
    @mkajiwala1 2 ปีที่แล้ว

    Is it possible to help me on my ongoing project, where ever I am stuck, may be on charges

    • @RaddyDev
      @RaddyDev  2 ปีที่แล้ว

      I am currently fairly busy and cannot offer one to one help. There must be websites out there where you can hire someone to help you

  • @ulfinawakjira1977
    @ulfinawakjira1977 2 ปีที่แล้ว

    can you show this tutorial in react??

    • @RaddyDev
      @RaddyDev  2 ปีที่แล้ว

      I haven't started making React videos just yet. Maybe.. maybe in near future. There might a tutorial out there already or stack overflow

  • @mkajiwala1
    @mkajiwala1 2 ปีที่แล้ว

    My project is on member association

  • @suchidoodles
    @suchidoodles 4 ปีที่แล้ว

    Can you tel me "i add select form one by one selecting items and create diferent table in that select item"🙄 how can i create that???

    • @RaddyDev
      @RaddyDev  4 ปีที่แล้ว

      Hey, I don't fully understand your question. Try to google it as you'll most likely be able to find a solution quickly. Stackoverflow is full with answers

  • @sukmawijaya4144
    @sukmawijaya4144 2 ปีที่แล้ว

    Can you make from mongodb ?

    • @RaddyDev
      @RaddyDev  2 ปีที่แล้ว +1

      I haven't done much PHP lately, but I might get back on it. That's purely because most web servers come with mysql for free. MongoDB is pretty nice... i'll consider it

  • @ALSTATH
    @ALSTATH 3 ปีที่แล้ว

    Hello im nead helps

    • @RaddyDev
      @RaddyDev  3 ปีที่แล้ว

      What's up?

  • @nayanaalur1208
    @nayanaalur1208 4 ปีที่แล้ว +1

    can i get the code?

    • @RaddyDev
      @RaddyDev  4 ปีที่แล้ว +1

      Of course: raddy.co.uk/blog/show-selected-option-value-from-array-mysql-db-using-php/

    • @nayanaalur1208
      @nayanaalur1208 4 ปีที่แล้ว

      Which is easy JS or PHP??

    • @RaddyDev
      @RaddyDev  4 ปีที่แล้ว

      PHP might be easier to learn, but if you want to do front-end development is better to choose JavaScript. PHP is for only server-side development.