2017-04-19 30 views
-6
<html> 
    <body> 
     <form name="trim_video_form" id="trim_video_form" action="video_ajax.php?v=54f85644" method="post"> 
      <input type="hidden" name="action" value="crop_video"> 

      <div class="trim_video_outr"> 
       <!--<iframe src="embed.php?v=54f85644&statTrack=&w=512&h=288&iframe=1&trimmingType=video" width="512" height="288" frameborder="0" scrolling="no" id="trim_video_popup_iframe"></iframe>--> 
       <iframe src="http://easyweb.site/embed.php?v=54f85644&amp;statTrack=&amp;w=512&amp;h=288&amp;iframe=1&amp;trimmingType=video" width="591" height="335" frameborder="0" scrolling="no" id="trim_video_popup_iframe"></iframe> 

      </div> 

      <div class="show_time_row"> 

       From : &nbsp;<input type="text" name="start_time_show" style="width:60px;" class="start_time_show show_time_input"> 

       <input type="hidden" name="start_time" style="width:60px;" class="start_time" value="Left-Flag">&nbsp; 

       To : &nbsp;<input type="text" name="end_time_show" style="width:60px;" class="end_time_show show_time_input"> 

       <input type="hidden" name="end_time" style="width:60px;" class="end_time" value="24.24641666666667"> &nbsp; Seconds 

      </div> 

      <div style="margin:14px 0; color:#676767;"> 

       <input type="radio" name="save_new" class="save_new" value="1" checked="checked"> Save As New Video 

       <input type="radio" name="save_new" class="save_new" value="0" style="margin-left:15px;"> Overwrite Original<br> 

      </div> 

      <div class="trim_video_title">Video Title : &nbsp; <input type="text" name="video_title" value="" class="video_title_input trim_title"><br><br></div> 

      <input type="button" name="upload" id="trim_image_btn" value="Trim Video" class="blackbtn"> 
     </form> 
     <input type="hidden" value=""> 
     <input type="submit" > 
     </form> 
    </body> 
</html> 

js代碼沒進去後值由jQuery的

function trimVideo(startTime, endTime) 
{ 
    $('.start_time').val(startTime); 
    $('.end_time').val(endTime); 
    var startTime = secondsToHms(startTime); 
    var endTime = secondsToHms(endTime); 
    $('.start_time_show').val(startTime); 
    $('.end_time_show').val(endTime); 
} 

PHP代碼設置

if ($_POST['action'] == "crop_video") { echo '<pre>';var_dump($_POST);die('in ajax');} 

js函數被調用的價值變動。 這個php代碼是在ajax方法中調用的。

我可以看到value屬性添加了它的值到輸入字段。 我正在通過使用jQuery來設置輸入值。瀏覽器顯示值。但是,當我使用POST提交它時,在PHP文件POST顯示輸入值爲空。爲什麼

+1

請你更新你完整的代碼,這東西是不足以給你的答案,與jquare和PHP代碼 –

+0

輸入型隱藏和值來更新你如何期望一些數據decleared空??? –

+0

這是HTML不jQuery和非常糟糕的書面html @AsifUddin是也看到了,大聲笑 – Gert

回答

3

我相信那是因爲你缺少的屬性name

HTML

<input type="hidden" name="someProperty" value=""> 

PHP

<?php echo $_POST['someProperty']; ?> 
+0

可能是可能的,但沒有他的完整代碼,你不能說這是一個問題 –

+0

,將得到你沒有價值,因爲價值仍然是價值=「」 – Gert

0

不幸的是這將覆蓋提交POST值代碼。這就是爲什麼POST參數在接收時變空的原因。這段代碼沒有錯誤。