首页 \ 问答 \ 注意:未定义的索引:变量(Notice: Undefined index: variable)

注意:未定义的索引:变量(Notice: Undefined index: variable)

我正在尝试构建以下形式:

<form method="post" action="Index.php">
  <label>Name </label>
  <input name="name" placeholder="Type Here"><br />
  </br>
  <label>Email </label>
  <input name="email" placeholder="Type Here">
  <br /></br>
  <label style="display:block;">I need some information regarding:</label>
  <textarea name="message" placeholder="Type Here"></textarea>
  <br />
  <label>*What is 2+2? (Anti-spam)</label>
  <input name="human" placeholder="Type Here">
  <br />         
  <input id="submit" name="submit" type="submit" value="Submit" style="height:30px;">      
</form>

PHP:

<?php
  $name = $_POST['name'];
  $email = $_POST['email'];
  $message = $_POST['message'];
  $from = 'From: TangledDemo'; 
  $to = 'hello@emailaddress.com'; 
  $subject = 'Hello';
  $human = $_POST['human'];

  $body = "From: $name\n E-Mail: $email\n Message:\n $message";

  if ($_POST['submit'] && $human == '4') {               
    if (mail ($to, $subject, $body, $from)) { 
      echo '<p>Your message has been sent!</p>';
    } else { 
      echo '<p>Something went wrong, go back and try again!</p>'; 
    } 
  } else if ($_POST['submit'] && $human != '4') {
    echo '<p>You answered the anti-spam question incorrectly!</p>';
  }

  if ($_POST['submit']) {
    if ($name != '' && $email != '') {
      if ($human == '4') {               
        if (mail ($to, $subject, $body, $from)) { 
          echo '<p>Your message has been sent!</p>';
        } else { 
          echo '<p>Something went wrong, go back and try again!</p>'; 
        } 
      } else if ($_POST['submit'] && $human != '4') {
        echo '<p>You answered the anti-spam question incorrectly!</p>';
      }
    } else {
      echo '<p>You need to fill in all required fields!!</p>';
    }
  }
?>

但不断得到这些错误:

注意:未定义的索引:第19行的C:\ xampp \ htdocs \ bet4info \ Index.php中的名称

注意:未定义的索引:第20行的C:\ xampp \ htdocs \ bet4info \ Index.php中的电子邮件

注意:未定义的索引:第21行的C:\ xampp \ htdocs \ bet4info \ Index.php中的消息

注意:未定义的索引:第25行的C:\ xampp \ htdocs \ bet4info \ Index.php中的human

注意:未定义的索引:在第29行的C:\ xampp \ htdocs \ bet4info \ Index.php中提交

注意:未定义的索引:在第35行的C:\ xampp \ htdocs \ bet4info \ Index.php中提交

注意:未定义的索引:在第38行的C:\ xampp \ htdocs \ bet4info \ Index.php中提交

为什么会这样?


I am trying to build the following form:

<form method="post" action="Index.php">
  <label>Name </label>
  <input name="name" placeholder="Type Here"><br />
  </br>
  <label>Email </label>
  <input name="email" placeholder="Type Here">
  <br /></br>
  <label style="display:block;">I need some information regarding:</label>
  <textarea name="message" placeholder="Type Here"></textarea>
  <br />
  <label>*What is 2+2? (Anti-spam)</label>
  <input name="human" placeholder="Type Here">
  <br />
  <input id="submit" name="submit" type="submit" value="Submit" style="height:30px;">
</form>

The PHP code:

<?php
  $name = $_POST['name'];
  $email = $_POST['email'];
  $message = $_POST['message'];
  $from = 'From: TangledDemo';
  $to = 'hello@emailaddress.com';
  $subject = 'Hello';
  $human = $_POST['human'];

  $body = "From: $name\n E-Mail: $email\n Message:\n $message";

  if ($_POST['submit'] && $human == '4') {
    if (mail ($to, $subject, $body, $from)) {
      echo '<p>Your message has been sent!</p>';
    } else {
      echo '<p>Something went wrong, go back and try again!</p>';
    }
  } else if ($_POST['submit'] && $human != '4') {
    echo '<p>You answered the anti-spam question incorrectly!</p>';
  }

  if ($_POST['submit']) {
    if ($name != '' && $email != '') {
      if ($human == '4') {
        if (mail ($to, $subject, $body, $from)) {
          echo '<p>Your message has been sent!</p>';
        } else {
          echo '<p>Something went wrong, go back and try again!</p>';
        }
      } else if ($_POST['submit'] && $human != '4') {
        echo '<p>You answered the anti-spam question incorrectly!</p>';
      }
    } else {
      echo '<p>You need to fill in all required fields!!</p>';
    }
  }
?>

But constantly getting these errors:

Notice: Undefined index: name in C:\xampp\htdocs\bet4info\Index.php on line 19

Notice: Undefined index: email in C:\xampp\htdocs\bet4info\Index.php on line 20

Notice: Undefined index: message in C:\xampp\htdocs\bet4info\Index.php on line 21

Notice: Undefined index: human in C:\xampp\htdocs\bet4info\Index.php on line 25

Notice: Undefined index: submit in C:\xampp\htdocs\bet4info\Index.php on line 29

Notice: Undefined index: submit in C:\xampp\htdocs\bet4info\Index.php on line 35

Notice: Undefined index: submit in C:\xampp\htdocs\bet4info\Index.php on line 38

Why is it so?


原文:https://stackoverflow.com/questions/30775572
更新时间:2024-01-06 16:01

最满意答案

这是一个常见问题。 您应用了许多旋转,并且随着时间的推移,舍入误差总结。 过了一会儿,三个向量vUpvLookvRight不再标准化和正交。 我会使用以下两种方法之一:

1.不要存储vLookvRight ; 相反,只存储2个角度。 假设x是正确的,y是顶部,z是后面,存储a)视轴和xz平面之间的角度,b)视轴在xz平面上的投影与z轴之间的角度或x轴。 根据鼠标移动更新这些角度,并vRight计算vLookvRight

2.将vRight的y分量设置为0,因为vRight应该在xz-Plane中。 然后对矢量进行重新正规化(你知道矢量应该彼此垂直并且长度为1)。 因此,在计算新的vLookvRight ,应用以下更正:

vRight.y = 0
vRight = Normalize(vRight)
vUp = Normalize(Cross(vLook, vRight))
vLook = Normalize(Cross(vRight, vUp))

This is a common problem. You apply many rotations, and over time, the rounding errors sum up. After a while, the three vectors vUp, vLook and vRight are not normalized and orthogonal anymore. I would use one of two options:

1. Don't store vLook and vRight; instead, just store 2 angles. Assuming x is right, y is top, z is back, store a) the angle between your view axis and the xz-Plane, and b) the angle between the projection of your view axis on the xz-Plane and the z-Axis or x-Axis. Update these angles according to mouse move and calculate vLook and vRight from them.

2. Set the y-component of vRight to 0, as vRight should be in the xz-Plane. Then re-orthonormalize the vectors (you know the vectors should be perpendicular to each other and have length 1). So after calculating the new vLook and vRight, apply these corrections:

vRight.y = 0
vRight = Normalize(vRight)
vUp = Normalize(Cross(vLook, vRight))
vLook = Normalize(Cross(vRight, vUp))

相关问答

更多
  • 我不确定它是否会导致您的问题,因为简单的演示可能具有一致的帧速率,但您不应该按时间增量缩放鼠标移动。 这些线: XMMATRIX xRotation = XMMatrixRotationY(((float)-deltaX * (float)timer.Delta())); XMMATRIX yRotation = XMMatrixRotationX(((float)-deltaY * (float)timer.Delta())); 应该 float fRotationSpeed = 0.01f; // ...
  • 首先,Unity为第一人称控制器提供了标准组件,您无需从头开始,请查看资产 - >导入包 - >字符。 假设你是出于教育目的而做的,只是想自己实现它:据我所知,你想要朝向相机的方向移动。 因此,您需要的是将您添加到camera.transform.position的值乘以当前相机旋转,即代替 camera.transform.position += new Vector3 (0, 0, translation_v); 使用 camera.transform.position += (camera.tran ...
  • 这是一个常见问题。 您应用了许多旋转,并且随着时间的推移,舍入误差总结。 过了一会儿,三个向量vUp , vLook和vRight不再标准化和正交。 我会使用以下两种方法之一: 1.不要存储vLook和vRight ; 相反,只存储2个角度。 假设x是正确的,y是顶部,z是后面,存储a)视轴和xz平面之间的角度,b)视轴在xz平面上的投影与z轴之间的角度或x轴。 根据鼠标移动更新这些角度,并vRight计算vLook和vRight 。 2.将vRight的y分量设置为0,因为vRight应该在xz-Plan ...
  • [评论不适合评论] 请注意, 文档说明了这一点 此向量中的组件顺序与旋转轴匹配: 间距(x分量)是围绕节点x轴的旋转。 偏航(y分量)是绕节点y轴的旋转。 Roll(z分量)是绕节点z轴的旋转。 [Comment does not fit in a comment] Please note that the documentation states that The order of components in this vector matches the axes of rotation: Pitch ...
  • 检查jogl的pmvMatrix 相机: pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); pmvMatrix.glLoadIdentity(); pmvMatrix.gluPerspective(fov, aspect, zNear, zFar); pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); pmvMatrix.glRotatef(-pit ...
  • 在错误被修复之前(请参阅Yuval Adam的回答评论),一个工作(虽然很脏)的解决方案是将相机从场景中移除,然后创建一个新相机,为其添加控制并将新相机添加到场景中。 更新: TrackballControls现在有一个reset()方法。 在补间完成后调用它,一切都很好! ( https://github.com/mrdoob/three.js/commit/4f800f61809560c434bbbf12e76c3931e8e8c0fb ) Until the bug is fixed (see com ...
  • 几次测试后我发现了这个问题。 我的相机似乎使用了左手坐标系,但我的视角却是右手。 在z 0.9到-0.9之间,左手和右手系统都能够同意该模型应该是可见的,但是当我将它们移出那个空间时,除非我的相机完全在相同的坐标。 故事的道德 - 记住在整个代码中始终如一地使用相同的坐标系。 I discovered the problem after a few tests. It seems I was using a left-handed coordinate system for my camera, but r ...
  • 如果触发“onSurfaceTextureSizeChanged(SurfaceTexture texture,int width,int height)”,则调用以下方法: /** * Configures the necessary {@link android.graphics.Matrix} transformation to `mTextureView`. * This method should be called after the camera preview size ...
  • 发生这种情况是因为Rigidbody.AddForce采用世界空间向量,但是您给它一个局部空间向量。 使用Transform.TransformDirection将矢量从本地空间转换为世界空间。 Vector3 force = transform.TransformDirection(0, 0, pitch); camera.rigidbody.AddForce(force); This occurs because Rigidbody.AddForce takes a world space vecto ...
  • 我已经解决了同样的问题,因为libgdx相机原本没有返回旋转的功能,所以通过创建一个以度为单位返回相机旋转的函数来解决它。 public float getCameraRotation() { float camAngle = -(float)Math.atan2(camera.up.x, camera.up.y)*MathUtils.radiansToDegrees + 180; return camAngle; } 它 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)