Can anybody help me with this. I just want a simple if statement, except it returns

"The Name field has not been filled out"

regardless of whether it has or has not been filled out. Here's the code

$len = 1;
$name = $_POST['name'];
print "<br />";
if(strlen($name) < $len) {
	echo "The Name field has not been filled out";
include ("_form.php");
}
else {
echo " thanks for filling out our form" ; 

    your strlen code appears correct--and I tested the functionality--it appears to work as you wish it to--I would guess that taking a look at what is coming in over $_POST may fix the issue.

      I have no idea what it could be.

      this is the form: in _form.php

      <caption>All Fields Are Required</caption>
      <table border="1">
      <form action="form_complex_process.php" method="post">
      <tr><td>Name:<input type="text" value"name" /><br /></td></tr>
      <tr><td>Last Name: <input type="text" value"lastname" /></td></tr>
      <tr><td>E-mail:<input type="text" value"email" /></td></tr>
      
      </table>
      
      <select name="dropdownbox">
      <option value="chooseone" selected >--Choose one--</option>
      <option value="webdesigner">Web Designer</option>
      <option value="programmer">Programmer</option>
      <option value="manager">Manager</option>
      <option value="serveradministrator">Server Administrator</option>
      </select>
      <br />
      <input type="radio" name="button1" value"subscribe" checked />I wish to subscribe
      <input type="radio" name="button1" value"dontsubscribe" />No, I do not wish to subscribe
      <input type="submit" value="Submit" />
      </form>

      this is where it is displayed: form_complex.php

      include ("_form.php");

      and the error reporting page: form_complex_process.php

      <?
      
      $len = 1;
      $name = $_POST['name'];
      print "<br />";
      if(strlen($name) < $len) {
      	echo "The Name field has not been filled out";
      include ("_form.php");
      }
      else {
      echo " thanks for filling out our form" ;
      }
      ?>

      maybe this can help

        <tr><td>Name:<input type="text" value"name" /><br /></td></tr>

        should be

        <tr><td>Name:<input type="text" name="name" /><br /></td></tr>

        You need to set name="foo" if you want to access $_POST['foo']

          thanks dude, that fixed it.

            Write a Reply...