Like I have a select form.
Option_1Option_2 .....Option_n
The last n may be great, my design is that after the user form is submitted to MySQL, and then the user can edit it, then on the edit page, this single-selection form must appear as the value in MySQL is selected. I have read the values in MySQL is $value _select_1, how to control this select_1 form with PHP to the value of $value_select_1 to select it?
Shortly after learning PHP, I hope to advise.
Reply to discussion (solution)
Data in the database that is the data output that has been saved to take this value 1 and then the foreach output to determine whether the value is equal, equal is selected.
Data in the database that is the data output that has been saved to take this value 1 and then the foreach output to determine whether the value is equal, equal is selected.
Moderator give me remote chin
My environment is not good!!!!
Data in the database that is the data output that has been saved to take this value 1 and then the foreach output to determine whether the value is equal, equal is selected.
Girl
$value _select_1=1; $select _arr=array (' value_1 ', ' value_2 ', ' value_3 ', ' value_4 '); foreach ($select _arr as $value) { if (Intval (substr ($value, -1,1)) = = = $value _select_1) echo $value. ' Selected ';}
$value _select_1=1; $select _arr=array (' value_1 ', ' value_2 ', ' value_3 ', ' value_4 '); foreach ($select _arr as $value) { if (Intval (substr ($value, -1,1)) = = = $value _select_1) echo $value. ' Selected ';}
Thank you moderator, but why is 1 to 1?
$value _select_1=1; $select _arr=array (' value_1 ', ' value_2 ', ' value_3 ', ' value_4 '); foreach ($select _arr as $value) { if (Intval (substr ($value, -1,1)) = = = $value _select_1) echo $value. ' Selected ';}
Thank you moderator, but why is 1 to 1?
Understand, take the last one, thank you!
'; Echo '' For ($i =1; $i <=10; $i + +) { echo 'Option_ '. $i. ';} echo '; $cur = 10;echo ';? >
Better write functions to improve code reuse
'; Echo '' For ($i =1; $i <=10; $i + +) { echo 'Option_ '. $i. ';} echo '; $cur = 10;echo ';? >
This is good, but unfortunately I have already closed the post can not give you a cent, but still expressed great thanks