Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php表单提交不起作用_Php_Forms_Post_Submit - Fatal编程技术网

php表单提交不起作用

php表单提交不起作用,php,forms,post,submit,Php,Forms,Post,Submit,我用同样的方法制作了多个页面,但由于某种原因,无论我尝试了什么,我都无法将某些字段转移到电子邮件字段中。我完全没有得到任何数据。这是HTML的表单 <form action="interest.php" method="post" > <!-- BEGIN cardetail Form --> <table> <tr>

我用同样的方法制作了多个页面,但由于某种原因,无论我尝试了什么,我都无法将某些字段转移到电子邮件字段中。我完全没有得到任何数据。这是HTML的表单

    <form action="interest.php" method="post" >                                                   <!-- BEGIN cardetail Form -->
    <table>
    <tr>
    <td width="50" class="alignRight" style="font-weight:bold;" >Year:</td>
    <td width="10px"></td>
    <td width="112"><p name="carYear">2011</p></td>
    <td class="alignRight" style="font-weight:bold;" >Color:</td>
    <td width="10px"></td>
    <td><p name="carColor">Red</p></td>
    </tr>
    <tr>
    <td class="alignRight" style="font-weight:bold;" >Make:</td>
    <td width="10px"></td>
    <td ><p name="carMake">Honda</p></td>
    <td width="50" class="alignRight" style="font-weight:bold;">Trim:</td>
    <td width="10px"></td>
    <td>Car has some sort of trim on it.</td>
    </tr>
    <tr>
    <td class="alignRight" style="font-weight:bold;" >Model:</td>
    <td width="10px"></td>
    <td><p name="carModel">Accord</p></td>
    <td class="alignRight" style="font-weight:bold;">Miles:</td>
    <td width="10px"></td>
    <td><p>180,000</p></td>
    </tr>
    <tr>

    </tr>
    <tr>
    <td class="alignRight" style="font-weight:bold;">Options:</td>
    <td width="10px"></td>
    <td colspan="4">
    <p>
        Power Windows, 
            Power Locks, 
            Keyless Entry, 
            Cruise Control, 
            Climate Control, 
            2.6L V-Tech
    </p>
    </td>
    </tr>
    <tr>
    <td style="font-weight:bold;">Repairs/Maintenance:</td>
    <td width="10px"></td>
    <td colspan="4">Fuel line flush, Transmission flush, Coolant flush, Oil Change, New Oil Filter, New Fuel Filter, New Air Filter, New Radiator, Painted Driverside Door, New Tires, Brand New Wax Job, and Fully Detailed.</td>
    </tr>
    <tr>
<td class="alignRight"></td>
        <td></td>
<td><a href="#top">Back to Top</a></td>
        <td class="alignRight" style="font-weight:bold;">Price:</td>
        <td></td>
        <td class="price"><p><span class="price"><?php echo $carPrice; ?>$6,000</span><input class="showInterest" type="submit" name="showInterest" id="showInterest" value="Show Interest" /></td>
    </tr>

    </table>
    </form>                     <!-- END cardetail Form -->

年份:
2011年

颜色: 红色

制作: 本田

修剪: 这辆车有一些装饰。 型号: 雅阁

英里: 180000

选项: 电动车窗, 电源锁, 无钥匙进入, 巡航控制, 气候控制, 2.6升V-Tech

维修/保养: 燃油管路冲洗、变速器冲洗、冷却液冲洗、换油、新机油滤清器、新燃油滤清器、新空气滤清器、新散热器、喷漆的驾驶员侧车门、新轮胎、全新的打蜡作业,以及详细说明。 价格: 6000美元
下面是我试图将信息传输到的php代码

    <?php echo $_POST['carYear'] . " / " . $_POST['carMake'] . " / " . $_POST['carModel'] . " / " . $_POST['carColor']; ?>


现在,当我从服务器上运行代码时,我得到的是3“/”。出于某种原因,$\u POST没有获取任何数据。我尝试将其传递到一个变量中,然后插入示例中的数据。我做错了什么?有没有我遗漏的一个小错误?

为什么你没有得到任何东西是因为,你没有发布任何东西

您只有一个
,就是这个:

  <input class="showInterest" type="submit" name="showInterest"
               id="showInterest"  value="Show Interest" />

填写所有
值=''
,并提交表单

除了提交按钮之外,表单中没有任何输入,这就是您无法在表单中获取任何数据的原因

    <?php echo $_POST['carYear'] . " / " . $_POST['carMake'] . " / " . $_POST['carModel'] . " / " . $_POST['carColor']; ?>

了解有关php表单的更多信息

您没有发布任何内容。但是,如果你想保持你的结构,并实际发布一些东西。使用要发布的值添加一些隐藏的输入

您的输入如下所示:

<input type="hidden" name="carYear" value="2011"/>
<input type="hidden" name="carMake" value="Honda"/>
<input type="hidden" name="carModel" value="Accord"/>
<input type="hidden" name="carColor" value="Red"/>


等待。您只有一个
,它是提交按钮?好的。最终,所有关于汽车的信息都将从SQL数据库中提取出来,基本上我只是想设置它,这样客户就可以点击感兴趣的按钮,用汽车信息自动填写部分emailer表单,然后输入自己的姓名、电话、电子邮件。我没有复制整个页面,只是我现在正试图使用的部分。页面的其余部分加载良好。您可以签出页面本身[link](culturalvomit.com/ericsonauto/viewcar.html)单击按钮查看最后一页,唯一的php代码就是我上面发布的。@JeffWalters相信我,不是这样做的。查看一些关于如何先提交表单的教程,然后如何将其发布?我以前在标签里有个名字=”,所以我把它们移到中,希望能起作用。这并不是我想要用户输入的任何东西,我只是想把信息拉到我已经设置好的电子邮件表单中。让我了解一下,当一个人单击“显示兴趣”时,你想做什么?那么我可以只做type=“text”并禁用吗?我讨厌它的样子,但我需要它来工作。只要告诉我你想要什么,当一个人对表演感兴趣时,耳朵、牌子、型号、颜色。首先
viewcar.html
应该是
viewcar.php
,并且每辆车都应该有一个唯一的编号,除非你只卖一辆车,否则一旦我得到数据库设置,它就会被删除。我的客户不会接受域名,所以很遗憾,该部分被搁置。已经阅读了。我的大多数表格都是这样填写的。以前从来没有人告诉我它必须是一个输入字段。很高兴我现在知道了。@JeffWalters表单就是这样工作的,我很高兴我帮了你。若您需要从数据库中输入一个值,只需在输入标记后回显该值,您的输入将被db数据填充,这样您就可以在下一页OK中输入$u POST数组。只是确保我做对了。我是否应该有一个字段显示用户要读取的数据,然后是隐藏字段,这样我就可以将数据拉到emailer表单中?这只是为了保持当前的结构。但是,如果您希望同一字段同时执行这两项操作,请将替换为输入(type='text')。然后用CSSOk做样式。谢谢。这使我省去了很多挫折。我想当我们在PHP课上学习表单处理时,老师遗漏了一些重要的信息。你们帮我很快地解决了我的问题,并且做了很好的解释。
<input type="text" name="carYear">
<input type="hidden" name="carYear" value="2011"/>
<input type="hidden" name="carMake" value="Honda"/>
<input type="hidden" name="carModel" value="Accord"/>
<input type="hidden" name="carColor" value="Red"/>