Title: How to redirect by selecting an option value of datalist in php?
Tags: php
Question: i am new in php. As we use ajax for searching in php, in similar way we use datalist in .net, now i want to use datalist in php too. Do u have any idea how can we do that? but now the problem is "how to redirect to another page by selecting an option value"?
Code is as below:
<input type="text" list="gt"  /&gt;
<datalist name="dt" id="gt" &gt;
<?php
while($result33=mysqli_fetch_assoc($select33))
?&gt;
<option value="artistdetail.php?id=<?php echo $result33['ID']; ?&gt;"&gt; <?php echo    $result33['name']; ?&gt; </option&gt;
<?php
?&gt;
</datalist&gt;
Comment: want to pass Id and Name?

Comment: i just want to redirect on the page as mentioned in option value.


Here is another answer: Try this...
<option value="artistdetail.php?id=<?php echo $result33['ID']; ?&gt;"&gt; <?php echo    $result33['name']; ?&gt; <? echo ("onclick='location.href='artistdetail.php?id=$result33[ID]';");?&gt; </option&gt;

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 2, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2014:00:01/08/14', 'FavoriteCount': 0.0, 'PostTypeId': 1, 'Tags': '<php>', 'Title': 'How to redirect by selecting an option value of datalist in php?', 'ViewCount': 551, 'id': 20989669, 'user_AboutMe': '', 'user_AccountId': 3815234.0, 'user_DisplayName': 'Amrinder Singh', 'user_Reputation': 5082.0, 'user_Views': 1562.0, 'user_id': 3164751.0}}