我想在單擊表單提交時執行colorbox和php插入功能。如何對單個提交輸入類型執行colorbox和提交操作?
這是我的形式:
<form name="album" id="album" action="#">
<table>
<tr>
<td>Album Name</td>
<td><input type="text" value="" name="album_titlee" required></td>
</tr>
<tr>
<td colspan="2"><input class="button_new" type="submit" name="submit_album" id="submit_album" value="ADD"></td>
</tr>
</table>
</form>
這是我的顏色框編碼
<div style='display:none'>
<div id='inline_content' style='padding:10px; background:#fff;'>
<p>We recommend the following resolutions for different print sizes.</p>
<table>
<tbody>
<tr>
<th width="80" height="25">Size</th>
<th>Minimum Resolution</th>
</tr>
<tr>
<td height="25">3.5" x 5"</td>
<td>525 x 750 pixels (0.4 megapixels)</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
這是我的PHP函數[對於表單提交]:
<?php
if(isset($_REQUEST['submit_album']))
{
$album_titlee=$_REQUEST['album_titlee'];
$user_id=$_SESSION['ses_userid'];
$sql=mysqli_query($conn,"INSERT INTO tbl_album(user_id,album_title,album_status) VALUES ('".$user_id."','$album_titlee','Y')");
echo("<script type='text/javascript'>$.colorbox({inline:true,width:'50%', href:'#inline_content'});</script>");
}
?>
上面PHP代碼只是插入數據完美,但插入語句後,我需要在colorbox上打開#inline_content分區。它不' t執行。如何在將表單數據插入到數據庫後打開colorbox。
我有同一頁上的php和colorbox代碼。那麼我怎樣才能將單獨的url傳遞給php腳本。 –
所以你可以把PHP代碼放在不同的文件中。 – Eimsas
我達到了我的需要......感謝您的支持。 –