我有一个文本框和一个下拉菜单。这些显示/隐藏有两个单选按钮。 此值=“hariciLink”值是成功发布的,但此值=“dahiliLink”值是空的。我该如何解决这个问题? 谢谢你的回答。
<script type="text/javascript">
$(document).ready(function(){
$('input[type="radio"]').click(function(){
if($(this).attr("value")=="hariciLink"){
$(".box").not(".hariciLink").hide();
$(".hariciLink").fadeIn(300);
}
if($(this).attr("value")=="dahiliLink"){
$(".box").not(".dahiliLink").hide();
$(".dahiliLink").fadeIn(300);
}
});
});
</script>
<div class="form-group">
<label for="ikon" class="col-lg-2 control-label">Bağlantı</label>
<div class="col-lg-10">
<div class="radio">
<label><input type="radio" name="link" value="hariciLink"> Harici Link</label>
</div>
<div class="radio">
<label><input type="radio" name="link" value="dahiliLink"> Dahili Link</label>
</div>
</div>
</div>
<div class="box form-group dahiliLink">
<label for="link" class="col-lg-2 control-label">Seçiniz</label>
<div class="col-lg-10 selectContainer">
<select name="link" value="" class="form-control" required>
<option value="black">Black</option>
<option value="blue">Blue</option>
<option value="green">Green</option>
<option value="orange">Orange</option>
<option value="red">Red</option>
<option value="yellow">Yellow</option>
<option value="white">White</option>
</select>
</div>
</div>
<div class="box form-group hariciLink">
<label for="link" class="col-lg-2 control-label">Link</label>
<div class="col-lg-10">
<input type="text" name="link" placeholder="Örnek: http://www.websayfam.com" class="form-control"/>
</div>
</div>
$data = array();
if (isset($_GET['files'])) {
$error = false;
$files = array();
$uniqid = uniqid();
$uploaddir = '../../images/'.$uniqid;
foreach($_FILES as $file) {
if (move_uploaded_file($file['tmp_name'], $uploaddir.basename($file['name']))) {
$files[] = $uploaddir.$file['name'];
} else {
$error = true;
}
}
$data = ($error) ? array('error' = > 'There was an error uploading your files') : array('files' = > $files);
} else {
$arr - > image = $file['name'];
$_SESSION['image'] = "img-".$file['name'];
$arr - > ok = "ok";
$data = array('success' = > 'Form was submitted', 'formData' = > $file['name']);
}
答案 0 :(得分:0)
之所以如此,是因为当您有多个具有相同名称的单选按钮时,只会将所选单选按钮的值发布为该名称的值。