所以設置一個輸入的值,我有這個按鈕,你鍵入「創造」的稱號,並按,這裏是一個照片: 從另一個輸入
這裏是代碼:
<div class="input-group margin">
<div class="input-group-btn">
<button type="button" name="artButton" data-toggle="modal" data-target="#createArticle" class="btn btn-danger">Create</button>
</div>
<!-- /btn-group -->
<input type="text" class="form-control" id="artTitle" name="artTitle" placeholder="Article title">
</div>
</div>
我試過的是用兩個表單標籤作爲POST方法包圍它,然後使用$_POST['artTitle']
來回顯用戶在其他輸入中插入的內容,但它不起作用。
因此,基本上,當你按上創建,一個模式顯示了詢問信息有關的話題,我想標題,如果你在這一領域迫切創造... ...前鍵入自動填充,並且它不工作...
這裏是我試圖將值添加到其它輸入
<?php if(isset($_GET) && array_key_exists('artButton',$_GET)): ?>
<div class="form-group">
<label for="createArticleTitle">Title:</label>
<input type="input" class="form-control" value="<?php echo $_GET['artTitle']?>" id="createArticleTitle" name="createArticleTitle" maxlength="80" placeholder="Insert Article Title...">
</div>
<?php endif; ?>
請問您按一下按鈕帖子的形式? – Zeusarm
你說過你使用POST方法,那麼爲什麼你試圖從GET方法獲得價值 – JYoThI
這隻會工作一次,它會導致很多頁面刷新。更好地使用一些JavaScript庫。 https://select2.github.io/examples.html#data-ajax –