Multiform Woes

From: Date: Thu, 11 Jan 2001 18:14:10 +0000
Subject: Multiform Woes
Groups: php.general 
Request: Send a blank email to php-general+get-34058@lists.php.net to get a copy of this message
Hello This is my first post here and I am on the learning curve with php (php3 in particular as it is all my host has) and need help with a multi-page form. It is a subscription for users and consists of: 1) subscribe.php3 2) confirm.php3 subscribe.php3 is where the user enters data and then click's the "submit" button. It is a post action and refers to itself. If no errors are present it includes confirm.php3 which will display user inputs for them to verify as correct. If the click the "submit" button on this page it is supposed to write the inputs to the database. Herein lies the problem. It does not. For some reason the user inputs from subscribe.php3 do not write to the database but if I use <?print $we_first?> they display properly on confirm.php3. If I by-pass the confirmation and just write to the database it works. If I try to "halt proceedings" for the user to view it the user inputs disappear into oblivion. It looks as though the form action from subscribe.php3 and confirm.php3 are conflicting with each other. I have offered some code snippets below if anyone would be willing to help. Thanks Todd ++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++ Here is what I have in subscribe.php3: ++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++ CODE: <? if (count($HTTP_POST_VARS) <> 0) { //do stuff here to validate data - works ok } # Test form if send if ($err <> true) { include("/home/WWW/domain.com/htdocs/confirm.php3"); exit(); } } ?> FORM ACTION: <form action="subscribe.php3" METHOD="POST" ENCTYPE="multipart/form-data"> <input type="submit" value="Submit Subscription"> ++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++ Here is what I have in confirm.php3: ++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++ CODE: <? if (count($HTTP_POST_VARS) <> 0) { # Test form if send if (isset($confirm)) // If I remove this and the form action it writes perfectly but no confirmation available { /* declare some relevant variables */ $hostname = "db.domain.com"; $username = "bubba"; $password = "1234"; $userstable = "subscribe"; /* MySQL table created to store the data */ $dbName = "client"; /* make connection to database */ mysql_connect($hostname, $username, $password) OR die("Unable to connect to database"); mysql_select_db("$dbName") or die( "Unable to select database"); $query = "INSERT INTO $userstable (we_prefix,we_first,we_last,we_add1,we_add2,we_suite,we_city,we_prov,we_post al,we_phone,we_email,we_commetns,we_iud) VALUES ('$we_prefix','$we_first','$we_last','$fi_add1','$we_add2','$we_suite','$we_ city','$we_prov','$we_postal','$we_phone','$we_email','$we_cleancom', Null)"; $result = MYSQL_QUERY($query); /* Close the database connection */ MYSQL_CLOSE(); exit(); } } ?> FORM ACTION: <form action="confirm.php3" METHOD="POST" ENCTYPE="multipart/form-data"> <input type="submit" name="confirm" value="looks good...sign me up!">

« previous php.general (#34058) next »