注意:未定义的索引:变量(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
最满意答案
这是一个常见问题。 您应用了许多旋转,并且随着时间的推移,舍入误差总结。 过了一会儿,三个向量
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-Plane中。 然后对矢量进行重新正规化(你知道矢量应该彼此垂直并且长度为1)。 因此,在计算新的vLook
和vRight
,应用以下更正: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
andvRight
are not normalized and orthogonal anymore. I would use one of two options:1. Don't store
vLook
andvRight
; 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 calculatevLook
andvRight
from them.2. Set the y-component of
vRight
to 0, asvRight
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 newvLook
andvRight
, apply these corrections:vRight.y = 0 vRight = Normalize(vRight) vUp = Normalize(Cross(vLook, vRight)) vLook = Normalize(Cross(vRight, vUp))
相关问答
更多-
DirectX相机抖动(DirectX Camera Jitter)[2023-07-25]
我不确定它是否会导致您的问题,因为简单的演示可能具有一致的帧速率,但您不应该按时间增量缩放鼠标移动。 这些线: 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 ...
-
SceneKit中的相机旋转(Camera Rotation in SceneKit)[2023-10-04]
[评论不适合评论] 请注意, 文档说明了这一点 此向量中的组件顺序与旋转轴匹配: 间距(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 ... -
相机旋转(Camera rotation)[2022-03-13]
检查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 ... -
使用TrackballControls时重置相机位置/旋转(Reset camera position/rotation when using TrackballControls)[2022-04-28]
在错误被修复之前(请参阅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 ...
-
Unity相机旋转(Unity camera rotation)[2022-06-20]
发生这种情况是因为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; } 它 ...