What's new

Closed Pa help po sa option value

Behelit

Honorary Poster
Established
Joined
Aug 5, 2017
Posts
420
Reaction
98
Points
233
Hello sir andito nanaman ako hahaha, pwede po ba mag post ng dalawang values sa iisang option?

code ng option:

PHP:
 <option value="" readonly>-------Select Services-------</option>
                              <?php
                                $sql="SELECT * FROM services";
                                $stmt=$conn->query($sql);
                                while($row=$stmt->fetch(PDO::FETCH_ASSOC)){
                              ?>
                               <option value="<?php echo $row['services'] ?>"><?php echo $row['services']." (Available Doctor: )";?><?php echo $row['doctors']?></option>
                              <?PHP } ?>

sa db ko po kasi may 2 columns doon na services at doctors, di ko po kasi alam kung pwede i-post ang 2 values gamit ang iisang option, bale ang ginawa ko po muna nag echo nalang ako ng doctors.

php prob 1.JPG

Screenshot (1).png


thank you po sa sasagot
 

Attachments

Sounds like database design complexity issues...

Bakit need mo magpost ng 2 values gamit ang iisang option?
 
Last edited:
Sounds like database design complexity issues...

Bakit need mo magpost ng 2 values gamit ang iisang option?
gusto ko kasi sir minimal, kumbaga with ease for users to choose kaysa isa-isa po sila mag click ng option yun lang po, pero nag serge na ako sir need daw explode yung value sa ssrver side.

Yes pwede po multiple select :)
salamat po dito sir
 
gusto ko kasi sir minimal, kumbaga with ease for users to choose kaysa isa-isa po sila mag click ng option yun lang po, pero nag serge na ako sir need daw explode yung value sa ssrver side.


salamat po dito sir
You can achieve the same outcome by optimizing your database. My suggestion is you make tables for doctors and services offered. When you retrieve the data to get the services and available doctors, you can use join to retrieve data from two or more tables. You just need to reflect the data properly into your option button. Then, when a user selects a value from the option button, you need to submit the value from service (service id). You need to retrieve the data from both table (doctors and services) again when you process the submitted service id to get the information of the services and doctors. Admit that working in the back-end has complexity rather than reflecting UI into the user.
 

Similar threads

Back
Top