0
我有一個文本框和一個下拉菜單。這些顯示/隱藏兩個單選按鈕。 這個值=「hariciLink」值是張貼成功,但這個值=「dahiliLink」值是張貼空白。我該如何解決這個問題? 感謝您的答案。單選按鈕值=「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']);
}
嗨,感謝您的回覆。我該如何解決它?因爲我有這樣的PHP表單。 $ isim = $ _POST ['isim']; $ ikon = $ _POST ['ikon']; $ ustmenude = isset($ _ POST ['ustmenudeGizle'])? $ _POST ['ustmenudeGizle']:0; $ link = $ _POST ['link'] == NULL? '#':$ _POST ['link']; – Dogan
你想要發佈什麼?你想發送這兩個值到服務器?如果是這樣的話,你可以使用'input'標籤。如果您不想顯示這些輸入,則可以使用隱藏輸入'' –
我不想發送這兩個值。只是我會選擇單選按鈕,然後我填充,然後我會發送。就是這樣。但如果我從下拉列表中選擇,則發佈空值。我該如何解決它? – Dogan