mitydrum Posted February 20, 2008 Share Posted February 20, 2008 Hello all! I have created a form with multiple form fields. The problem I'm having is this.... When I fill out the form and then press enter from the last form field I loose all the data when it's passed; however, if I tab to the submit button and either press the button with the mouse or press the enter key the data is passed fine and the code works as it should. Has anyone run into an issue with this? My submit is as such... <form action="chapter3.php" method="post"> <input type="text" name="variable" size="10" maxlength="5" style="text-align: left; width: 40px"> <input type="submit" name="complete" value="Validate" /> </form> At the top of 'chapter3.php' I have the following code set as such... if(isset($complete)){ $variable = $_POST['variable']; ........ } Am I possibly using the isset function incorrectly, or am I missing something completely? Is there a difference when pressing enter from the form field when I'm done typing without tabbing out of the text box or clicking on the submit button directly? Any help would be appreciated. Thanks! Tony Quote Link to comment Share on other sites More sharing options...
PHP Monkeh Posted February 20, 2008 Share Posted February 20, 2008 Make your isset() line: if(isset($_POST['complete'])){ and give it another go. You said you had multiple form fields yet I only see one, did you trim them down? Make sure they're named differently, for obvious reasons. Quote Link to comment Share on other sites More sharing options...
mitydrum Posted February 20, 2008 Author Share Posted February 20, 2008 Thanks for the quick response. Yes I did trim this down quite a bit. The page along with code is just under 2000 lines of code...yikes! Anyway I tried your suggestion without success. I did double check the variable names as well and they are all unique in nature. Here is the actual top part of the code w/ variable names intact. <?php // page created by Tony Jankowski // last revision on 2/20/08 by Tony Jankowski session_start(); // start the session $sessionID = session_id($_GET['PHPSESSID']); include("../data.inc"); include("../connect.inc"); $uid = $_SESSION['uid']; $curyear = date("Y"); $complete = $_POST['complete']; if(isset($complete)){ $month555 = $_POST['month555']; $day555 = $_POST['day555']; $year555 = $_POST['year555']; $payee555 = $_POST['payee555']; $amount555 = $_POST['amount555']; $written555 = $_POST['written555']; $memo555 = $_POST['memo555']; $sig555 = $_POST['sig555']; $month556 = $_POST['month556']; $day556 = $_POST['day556']; $year556 = $_POST['year556']; $payee556 = $_POST['payee556']; $amount556 = $_POST['amount556']; $written556 = $_POST['written556']; $memo556 = $_POST['memo556']; $sig556 = $_POST['sig556']; $month557 = $_POST['month557']; $day557 = $_POST['day557']; $year557 = $_POST['year557']; $payee557 = $_POST['payee557']; $amount557 = $_POST['amount557']; $written557 = $_POST['written557']; $memo557 = $_POST['memo557']; $sig557 = $_POST['sig557']; $month558 = $_POST['month558']; $day558 = $_POST['day558']; $year558 = $_POST['year558']; $payee558 = $_POST['payee558']; $amount558 = $_POST['amount558']; $written558 = $_POST['written558']; $memo558 = $_POST['memo558']; $sig558 = $_POST['sig558']; $month559 = $_POST['month559']; $day559 = $_POST['day559']; $year559 = $_POST['year559']; $payee559 = $_POST['payee559']; $amount559 = $_POST['amount559']; $written559 = $_POST['written559']; $memo559 = $_POST['memo559']; $sig559 = $_POST['sig559']; // more code here after but way to lengthy to put here. :-) ?> Any other suggestions??? :-) Quote Link to comment Share on other sites More sharing options...
schilly Posted February 20, 2008 Share Posted February 20, 2008 You might want to look into the extract() function (http://ca.php.net/manual/en/function.extract.php) for cutting down some of those variable declarations. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.