I have a simple code where i query my database, and set the values in a option list, as shown in the code below :
<?php $postQuery="SELECT DISTINCT labelName FROM posts"; $postResult=mysqli_query($conn,$postQuery); ?> <form action="inc/set.php" method="post" enctype="multiform/partdata"> <input type="text" name="title" value="Add Title"><br> <select name="lable" > <option value="empty">Empty</option> <?php foreach ($postResult as $post) {;?> <option value="<?php echo $post['labelname'];?>"><?php echo $post['labelName'];?> </option> <?php } ;?> </select>
How can i pass the values from the option list that are in php code in the another page as shown in the form inc/set.php . And what would be the standart and best way to do that. Thank you for yo help folks.
Advertisement
Answer
Use a session variable! See: “PHP Sessions” at W3Schools.