HTML Form - PHP Question?
-
Ok I have about given up on this.. I have installed the Custom Contact Form Plugin through Wordpress. Since I already have my forms styled, I want to use the simple html code they give you. However, I am trying to put a simple php script on the same page so when it is submitted, It will echo a message. However, I tried using If (isset(['submit'])) and it doesn't work. I actually tried a handful of things and I still can get any kind of validation variable. I even tried adding the hidden form field "pagesuccess = 1" and tried using if (!empty($_POST['pagesuccess'])) { and it still has no data coming back to me. Please see the PHP code at the bottom. That is where my validation PHP code is. Here is my code: <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>" id="contactform"> <input type="hidden" name="ccf_customhtml" value="1" /> <input type="hidden" name="destination_email" value="MY@EMAILGOESHERE" /> <input type="hidden" name="pagesuccess" value="1" /> <ol> <li> <label for="name">Full Name:</label> <input id="name" name="name" class="text" style="width: 178px; height: 16px;" /> </li> <li> <label for="email">Your email:</label> <input id="email" name="email" class="text" style="width: 178px; height: 16px;" /> </li> <li> <label for="company">Your Phone:</label> <input id="company" name="phone" class="text" style="width: 178px; height: 16px;" /> </li> <li> <label class="brief1">Briefly Describe Your Legal Issue:</label> <textarea cols="20" name="info" rows="3" style="width: 272px; height: 50px;"></textarea></li> <li class="buttons"> <input type="image" name="submit" value="submit" alt="Submit Information" src="<?php echo get_option('siteurl') ?>/wp-content/themes/azure-basic/images/… height="42" width="272" /> <div class="clr"></div> </li> </ol> </form> <?php if (isset($_GET['submit'])) { echo '<div class="disclaimerdiv-confirm">Your Message Has Been Submitted!</div>'; } else { echo '<div class="disclaimerdiv"><a href="' . get_option('siteurl') . '/divorce-attorneys-privacy-policy/">Dis… & Privacy Policy</a></div>'; } ?>
-
Answer:
I think you were on the right track with "pagesuccess = 1", but rather than checking if(!empty($_POST['pagesuccess'])), you should check if the value of pagesuccess is 1: <?php if($_POST['pagesuccess'] === 1) { echo '<div class="disclaimerdiv-confirm">Your Message Has Been Submitted!</div>'; } else { echo '<div class="disclaimerdiv"><a href="' . get_option('siteurl') . '/divorce-attorneys-privacy-policy/">Dis… & Privacy Policy</a></div>'; } ?>
Phil M at Yahoo! Answers Visit the source
Related Q & A:
- How to store data in php and get data from php?Best solution by Stack Overflow
- How to remove your question from yahoo question/answers?Best solution by Yahoo! Answers
- What is an easy code for a form in PHP?Best solution by Stack Overflow
- How to remove a question in the ask question editor?Best solution by Meta Stack Overflow
- Why are HTML and PHP forms not working?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.