我有一个PHP的CRUD系统,用户可以选择一个选项,我想要的选项是与目标的外部超链接。我无法弄清楚我可以把这两个链接放在哪里,这可能与我的代码?从选择PHP MySQL超链接
的index.php
<td><?php echo $row['usertype'] ?></td>
create.php
<div class="form-group">
<label for="gd">User Type</label>
<select class="form-control" id="gd" name="gd">
<option>Administrator</option>
<option>NetMan</option>
</select>
</div>
update.php
<?php
$usertypes = array('Administrator' => 'Administrator', 'NetMan' => 'NetMan');
$selcted_usertype = !empty($row['usertype']) ? $row['usertype'] : "";
?>
<label for="gd">User Type</label>
<select class="form-control" id="gd" name="gd">
<?php
foreach ($usertypes as $user_type_val => $usertype_txt) {
$selected = ($user_type_val == $selcted_usertype) ? "selected='selected'" : "";
?>
<option <?php echo $selected; ?> value="<?php echo $user_type_val; ?>"><?php echo $usertype_txt; ?></option>
<?php }
?>
请详细说明你的问题。你想重定向,如果用户更改下拉值? –
对不起,当用户在索引页面上看到表格时,我希望文本是一个超链接,所以基本上这两个选项都将是一个外部链接 – Jay
最终我会有10个选项,所有将要分开的外部网站 – Jay