Jump to content

What is wrong with this form?


Go to solution Solved by requinix,

Recommended Posts

OK, it's been a while since I've programmed anything in PHP...what am I missing here? If I print_r the post variable, I get the submit, but not the input field. I talked tech support at my hosting company and all they could tell me was that it was hitting a mod sec rule .

 

<?php


if (!$_POST) {
     
?>


<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>jQuery UI Datepicker - Animations</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script>
  $(function() {
    $( "#date1" ).datepicker({ minDate: 0, maxDate: "+36M" });
  });
  </script>
</head>
<body>


<form method="post" action="#">
<input type="text" id="date1" size="8">
<br />
<input type="text" id="date2" size="8">
<br />
<input type="submit" name="submit">
</form> 
</body>
</html>


<?php 


} else {


echo $_POST['post1'];
echo $_POST['post2'];


}


?>
 

 

Edited by jlknauff
Link to comment
https://forums.phpfreaks.com/topic/299773-what-is-wrong-with-this-form/
Share on other sites

  • Solution

Ah, hosting support...

 

Form inputs only work if you give them names. The IDs are just for the client side - mostly Javascript.

<form method="post" action="#">
<input type="text" id="date1" name="post1" size="8">
<br />
<input type="text" id="date2" name="post2" size="8">
<br />
<input type="submit" name="submit">
</form> 
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.