dongziya9863 2015-11-03 10:02
浏览 28

自动提交不在此脚本上工作

I have been implementing all the javascript auto submit, but it reloads the page and does not submit the form, please help me.

<?php
ERROR_REPORTING(0);
include("../jesus/settings.php");
include("../jesus/connect.php");
#include("../jesus/header.php");
include("../jesus/func.php");

$errors=array();
if(isset($_POST["submit"]))
{
    $link=cleanvalues($_POST["link"]);
    $cat=cleanvalues($_POST["cat"]);
    $img=cleanvalues($_POST["img"]);
    $comment=cleanvalues($_POST["comment"]);
    $description=cleanvalues($_POST["description"]);
    $prefix=cleanvalues($_POST["prefix"]);
    $format=cleanvalues($_POST["format"]);
    $folder=cleanvalues($_POST["folder"]);
    $title=cleanvalues($_POST["title"]);
    if(empty($title) || strlen($title)<4)
    {
        $errors[]="Your title is too short";
    }
    if(empty($comment) || strlen($comment)<4)
    {
        $errors[]="Your comment is too short";
    }
    if(empty($cat))
    {
        $errors[]="You must select a category";
    }

    $check=mysql_num_rows(mysql_query("SELECT * FROM b_movies WHERE     title='$title'"));
    if($check>0)
    {
        $errors[]="FILE already Exists";
    }
    if(count($errors)==0)
    {
        $user=$user;
        $date=time();
        $insert=mysql_query("INSERT INTO b_movies SET `title`='$title',
    `prefix`='$prefix',
    `format`='$format', `comment`='$comment', `catid`='$cat',     `link`='$link', `img`='$img', `by`='$user', `time`='$date'");

        if(!$insert)
        {
            $msg=mysql_error();
        }
        else
        {
            $msg="Upload successful";
        }
       $query=mysql_query("SELECT * FROM b_moviescat where id=$cat");
        while($cinfo=mysql_fetch_array($query))
        {
            $cname=$cinfo["name"];
            $cbody=$cinfo["body"];
            $kellyprefix=$cinfo["name"];
            $kellyprefix=kellychiprefix($kellyprefix);

            $idd=mysql_insert_id();

            $insert=mysql_query("INSERT INTO b_updates SET prefix='$prefix',  title='$title', folder='$kellyprefix', url='$idd', description='$comment', time='$date', img='$img'");

            header("location: /cron_jobs/sitemap_updater.php?msg=$msg?$title");
            exit();
        }
    }
    else
    {
        foreach($errors as $error)
        {
            $string.="$error<br/>";
        }
        echo"<div class='msg'>$string</div>";
    }
}
echo"";
//ERRORS
echo"<form name='kellychi' id='kellychi' action='' method='POST'>
<ul><li> title<br/><input size='100' type='text' name='title' value='$name'></li>
<li><center><select name='cat'><option value='4'>Naija Movies</option>";
$query=mysql_query("SELECT * FROM b_moviescat");
while($cinfo=mysql_fetch_array($query))
{
    $cid=$cinfo["id"];
    $cname=$cinfo["name"];
    $cbody=$cinfo["body"];
    echo"<option value='$cid'>$cname</option>";
}
echo"</select></center></li><li>Link<input size='100' type='text' name='link' value='http://highspeed-cbt.com/yt/getvideo.php?videoid=".$_GET['id']."&type=Download'></li>
<li><textarea rows='7' cols='60'  name='comment'>".$dtag."

Download And Enjoy...</textarea></li>

<li><input size='100' type='text' value='http://img.youtube.com/vi/".$_GET['id']."/0.jpg' name='img'></li>
<li>prfx<input size='100' type='text' name='prefix' value='Download'></li>
<li>YT<textarea rows='7' cols='30'  name='format'><iframe width='640' height='360' src='https://www.youtube.com/embed/".$_GET['id']."'     frameborder='0' allowfullscreen></iframe></textarea></li>
<li><center></center></li></ul></form>"; ?>


<script>
    setTimeout(function() {
        document.forms[0].submit();
    }, 5000);
</script>

<?php
#echo"<div class='center'><ul><span class='style4'></span></ul></div>";
#echo"<br>";

?>
  • 写回答

1条回答 默认 最新

  • dounai1986 2015-11-03 10:25
    关注

    There is no such element as: "$_POST["submit"]" in array. You need to use other field name like:

    if(isset($_POST["title"]))....
    

    If you put: print_r($_POST) You will see all post values send. And you can choose different one or add hidden value:

    <input type="hidden" name="submit" value="1" />
    

    This will also work.

    评论

报告相同问题?

悬赏问题

  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算