1

This is stupidly simple, but I can't figure out why I constantly get the error msg here, it looks right and works right in other applications....is this due to the "0" zeros? It shouldn't be because it's returning the error before it gets to any of the other stuff, pls help! been staring at this so long Im getting to that "can't see the forest from the trees" point.

PHP

<?php
    if(empty($_POST['Contact0FirstName']) || empty($_POST['Contact0LastName']) ||
    empty($_POST['Contact0Email']) || empty($_POST['Contact0Phone1']) ||
    empty($_POST['CaptchaInput']) || !empty($_POST['LeadBlind'])) {
echo "Please fill out all fields marked *";
die();
} else {

//curl stuff
}
?>

and the form

<form id="Lead" method="post" action="PHP/Lead.php" accept-charset="UTF-8">


                <ul id="LeadForm">
                    <li>*required field</li>
                    <li>
                        <input type="hidden" name="LeadBlind" id="LeadBlind">
                        <label for="Contact0FirstName">1| First Name*</label>
                        <label for="Contact0LastName">2 | Last Name*</label>
                        <label for="Contact0Email">3 | Email*</label>
                    </li>
                    <li>
                       <input type="text" name="Contact0FirstName" id="Contact0FirstName">
                        <input type="text" name="Contact0LastName" id="Contact0LastName">
                        <input type="text" name="Contact0Email" id="Contact0Email">
                    </li>

                    <li>
                        <label for="Contact0Phone1">4| Daytime Phone*</label>
                        <label for="Contact0Phone2">5| Evening Phone</label>
                        <label for="CaptchaInput">6| Please enter the code</label>
                    </li>
                    <li>
                        <input type="text" name="Contact0Phone1" id="Contact0Phone1">
                        <input type="text" name="Contact0Phone2" id="Contact0Phone2">
                        <input type="text" class="numbers" name="Captcha" id="Captcha" value="" readonly>
                        <input type="text" class="numbers" name="CaptchaInput"  id="CaptchaInput" size="6" maxlength="6">
                    </li>
                    <li>
                        <input type="submit" id="LeadSend" value="Try It Now!">
                        <span id="processing">Submitting Your Request</span>
                    </li>

                    <li class="text">You will get 30 days of NinjaTrader + Rithmic (the data feed) to experience how trading should really be.</li>
                    <li class="text"><a href="mailto:[email protected]?subject=Trader's Platform Support Request">Email Support</a> or call 800 771 6748 (Optimus Trading Group)</li>
                </ul>
                <div class="clear"></div>
            </form>

In firebug, it shows the fields getting passed, with a value, but I get the "Please fill out all fields marked *" error returned.

0

3 Answers 3

2
!empty($_POST['LeadBlind'])

nothing else leads to the problem

try making it to check if its empty else try removing fields one by one to see where exactly is the problem

otherwise

add var_dump($_POST); after <?php tag

Sign up to request clarification or add additional context in comments.

2 Comments

I put that exactly like above on the second line and it returned a Parse Error on line 2. I have the "LeadBlind" to try and detect bots, its a hidden input that if a bot fills out it should return and error. People won't see it, and thusly shouldn't fill it out. Am I wrong here?
whats your php info, you maybe are using outdated version (4) or something, or you miscompiled it, try doing phpinfo(); and give the version back
1

Between here:

 <?php
      if(empty($_POST['Contact0FirstName']) ...

Please put a

print_r($_POST);

And make sure all the keys you're accessing the data from are correct and populated.

IE:

<?php
print_r($_POST);
if(empty($_POST['Contact0FirstName']) ...

2 Comments

I put the print_r($_POST); and it returns this in firebug Array ( ) Please fill out all fields marked *
You can review it in firebug, but just view-source on the page in question that's actually running the code and you'll see an array with keys (the form keys) and values...match those up and see if you have a spelling error.
0
!empty($_POST['LeadBlind']

This field can only be empty, because it's hidden and you didn't assigned a value to it.

Also, this is very poor HTML (Tags should be closed) and I would use the isset()-function on every $_POST-field that is been set in your Form. Because if a field has no value and the form is being send, there is no entry in the $_POST-Array in the first place.

3 Comments

nice, same idea, facebook slowed me to post it first =P
I use the 'LeadBlind' to "try" and detect bots, as it is a hidden field a human wouldn't see, so if a bot fills it in, and it then has a value - it fails.
What Bot would fill in a hidden field?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.