PHP - Moved: Webform - How Do I Make An Error Page Appear For Bad Submissions?
This topic has been moved to Third Party PHP Scripts.
http://www.phpfreaks.com/forums/index.php?topic=354321.0 Similar TutorialsI have multiple PHP forms set up. Most of them have few fields that if not filled up the form will not be submitted. And one question that if you answer wrong you will not get through either. With this I have eliminated most "hgdgfgdhsj" style forms submissions by spam bots. But every now and then I get ghost or empty form submission. In database I get records (only one at a time) that are fully blank (every now and then). This confuses me. How and why does it happen, and mainly how do I prevent it? Thanks Is it possible to submit two upload input types on a form. Ex. I'm using a basic form input file upload, and would like to use a php_self to upload since its just one small file. But I also need a second set of files up to 10 files to be upload via a flash upload script. how can i set the form action to process itself (the php coding up top) then process the upload.php file? would if work if i just stuck and execute for the upload.php at the bottom of the php coding for the first upload process? The user uploads a csv file then is required to upload the supporting files. the csv gets inserted to the db and all the files to the temp folder. the upload.php script processes each file separately so sticking the upload process for the csv in the upload.php file would make it import multiple times everytimes till all the supporting files have been uploaded. i'm trying to avoid that. Code: [Select] <?php if(isset($_POST['submit'])) { // check .csv file has been uploaded... and on the server proceed if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], '../temp/files/')) { $filename = file_get_contents($_FILES['uploadedfile']['name']); $handle = fopen("$filename", "r"); while (($data = fgetcsv($handle, 100000, ",")) !== FALSE) { if(file_exists('/temp/files/'. $data[0] .'.docx')) { rename('/temp/files/'. $data[0] .'.docx', '/docx_files/'. $data[0] .'.docx'); $import="INSERT into kmmb_member1(docx_id,no_ahli,no_pin,nama,no_ic_baru,no_ic_lama) values('$data[0]','$data[1]','$data[2]','$data[3]','$data[4]')"; mysql_query($import) or die(mysql_error()); } } fclose($handle); print "Import done"; } else { echo "There was an error uploading the *.csv file, please try again!"; } } else { ?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title></title> <script type="text/javascript"> var swfu; SWFUpload.onload = function () { var settings = { flash_url : "swf_up/swfupload/swfupload.swf", flash9_url : "swf_up/swfupload/swfupload_fp9.swf", upload_url: "swf_up/upload.php", post_params: { "PHPSESSID" : "NONE", }, file_size_limit : "100 MB", file_types : "*.wav", file_types_description : "Wave Files", file_upload_limit : 100, file_queue_limit : 0, custom_settings : { progressTarget : "fsUploadProgress", cancelButtonId : "btnCancel" }, }; swfu = new SWFUpload(settings); } </script> </head> <body> <div id="content"> <h2>Upload</h2> <form id="form1" action="index.php" method="post" enctype="multipart/form-data"> <div id="divSWFUploadUI" style="margin-top: 20px;"> <span>Select .csv file: <input name='uploadedfile' type='file' /><br /> </span> <div class="fieldset flash" id="fsUploadProgress"> <span class="legend">Upload Queue</span> </div> <p id="divStatus">0 Files Uploaded</p> <p> <span id="spanButtonPlaceholder"></span> <input id="btnCancel" type="button" value="Cancel All Uploads" disabled="disabled" style="margin-left: 2px; height: 22px; font-size: 8pt;" /> <br /> </p> </div> </form> </div> </body> </html> <?php } ?> ok ive searched everywhere online for a webform that is in 2 or more parts... so the first page passes variables to the second page then saves info for next page to submit all info from both pages of application to a server etc. ideally my page would look like this... page 1: small form with 3 fields: 1. type of loan: [dropdown menu] a. Cashout refinance b. Purchase 2. Property type: [dropdown menu] a. single family b. multi-unit, etc. 3. Property State: [dropdown menu] a. states....... [Next Page] <---Button page 2: a few more fields: (for example:) 1. Approximate credit score [dropdown menu] a. 650-700 etc.... 2. Phone number [textbox] 3. email address [textbox] [submit button] I know its possible, i just need to be put on the path... any help is much appreciated! This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=349726.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=317523.0 This topic has been moved to Apache HTTP Server. http://www.phpfreaks.com/forums/index.php?topic=351923.0 Lets say a website is dedicated to two different people (Bob and Richard). The site has a contact page in which people can email the two people. Is it possible to create a form in which someone can enter a message but there are two submission options. So in this example there are two images. One reads "Send Email to Bob" and the other reads "Send Email to Richard". Is it possible to do this or to have two submission methods from one form? How do you turn off a php form after a set number of submissions? My form is not hooked up to a mysql database. Theoretically I think I would need to set something up that increments a number with each successful form submission. Then when the form hits a certain limit number like 300 it shuts off or hides the div that contains the form. Has anyone done something like this before? Any help or even just pointing me in the right direction is greately appreciated! Assume this project is to create an online lottery system. Is there a way to limit the user entering the numbers after a certain time? E.g. The Draw will be at 9.00PM 05 November 2010 - Submitting the numbers will expire after 8.00PM 05 November 2010. (so any user tries to submit numbers after 8.00PM 05 Nov 2010 will not be entered in to the MySQL db). Any help is highly appreciated. Dear All, I am writing a code to register new users on my website http://www.computationalphotography.in/registration.php. I want the page to check the entries in each field and return an error if any field is left blank or an invalid data-type has been entered. Could you please suggest ways to achieve this? Below is my code for the form: Code: [Select] <html> <head> <title> Photography Experiment Registration </title> </head> <body> <h1> Questionnaire </h1> <h3> We would like to know about your background and interests in photography. For each multiple-choice question, please circle all answers that apply.</h3> <form method="post" action="registration.php"> Note that all fields marked with * are mandatory <br> <br> Name* <input name="name" type="text"> <br> <br> Email  <input name="email" type="text"> <br> <br> Password<pre></pre> <input type="password" name="password"> <br> <br> Re-Type Password<pre></pre> <input type="password" name="password"> <br> <br> 1.) Roughly How many pictures do you take each year? <br> <br> <input name="o1q1" type="radio" value="a"> a) a few: <10 in a year <br> <input name="o2q1" type="radio" value="b"> b) many: probably 100's a photos a year <br> <input name="o3q1" type="radio" value="c"> c) a lot: probably 1000's of photos a year <br> <br> 2.) Do you share your pictures with anyone? <br> <input name="o1q2" type="radio" value="a"> a) No <br> <input name="o2q2" type="radio" value="b"> b) Yes, but only with friends or family <br> <input name="o3q2" type="radio" value="c"> c) Yes, I share with friends or family and also post on public sites such as Flickr, Picasaweb, or Snapfish for anyone to see. <br> <input name="o4q2" type="radio" value="d"> d) Yes, I share frequently and I have also published my photos in books or magazines, or exhibited my photos in shows. <br> <br> 3.) How much training in photography have you had? <br> <input name="o1q3" type="radio" value="a"> a) None <br> <input name="o2q3" type="radio" value="b"> b) Some, but it's self-taught from books or websites <br> <input name="o3q3" type="radio" value="c"> c) Quite a bit: I have taken courses in photography <br> <input name="o4q3" type="radio" value="d"> d) A lot:I have completed a degreee or certificate in the subject <br> <br> 4.) How do you describe yourself as a photographer? <br> <input name="o1q4" type="radio" value="a"> a) A novice:someone who takes a few pictures occasionally <br> <input name="o2q4" type="radio" value="b"> b) An amateur:someone who takes many photos, but doesn't usually share them <br> <input name="o3q4" type="radio" value="c"> c) An enthusiast:someone who loves to take pictures, possibly shows them with oters on public sites, or who might own a DSLR, or frequently uses a camera in other than "automatic mode" <br> <input name="o4q4" type="radio" value="d"> d) An expert:skilled photographer who has published their work, or exhibited their work in shows, or has been paid for their work <br> <br> 5.) Do you have artistic training or exposure? <br> <input name="o1q5" type="radio" value="a"> a) No <br> <input name="o2q5" type="radio" value="b"> b) I visit museums or art galleries <br> c) I have studied art: please describe <br> <textarea name="data5c" cols="50" rows="5"> </textarea> <br> d) I am a practicing artist: please describe <br> <textarea name="data5d" cols="50" rows="5"> </textarea> <br> <br> 6.) Some optional information, if you don't mind. We respect your privacy. <br> <br> Age <br> <textarea name="6a" cols="1" rows="1"> </textarea> <br> <br> Gender <br> <input name="male" type="radio" value="a"> a) Male <br> <input name="female" type="radio" value="b"> b) Female <br> <br> Languages Spoken <br> <textarea name="6b" cols="25" rows="2"> </textarea> <br> <br> Languages Read <br> <textarea name="6c" cols="25" rows="2"> </textarea> <br> <br> <br> <input type="submit" value="Send"> <input type="reset" value"Reset"> </form> </body> </html> Thank you for your help. I have a few more queries regarding this web-form, but will mention them once this query is resolved. Hi, I'm trying to get a php webform to log onto the database automatically before it loads on the website page. In other words I don't want the customer having log onto the database or be a guest. I think I need the code below to do that. Question is, can I just add this code into the php file that is the webform or add the <?php ?> to it and have it above the webform php code. Also do I need to alter any other dbconnect php pages as well? Also do I need to edit the htaccess file also. function verify_code() { $connection = mysql_connect ("localhost", "fred", "kool3401") or die ('Error: ' . mysql_error()); $db = mysql_select_db ("october"); { echo "Authenticated"; } Many Thanks This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=315281.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=344105.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=323310.0 This topic has been moved to Apache HTTP Server. http://www.phpfreaks.com/forums/index.php?topic=343321.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=311225.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=315050.0 This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=307669.0 Okay, I'm trying to make it so that when someone levels up in my game, they can use stat bonus points to increase their abilities. However, there doesn't seem to be a break in there to ensure that someone can't spend points that they don't have. For instance, they get 3 per level, but if they spend 6, the system lets them and shows a -3 in their stat_bonus field. Any help would be appreciated! Thanks in advance!! <?php include("fightfunc.php"); include("lib.php"); //include('cookies.php'); //$link = opendb(); define("PAGENAME", "Stat Bonus"); $player = check_user($secret_key, $db); $x = $player->username; if($_SESSION['234asdfas']){$y = $_SESSION['234asdfas'];}else{echo 'Error: You do not have a session variable set'; exit;} $command = 1; $choice = $_POST['choice']; $amount = $_POST['amount']; if (isset($_POST["statbonus"])) { include("tmpconfig.php"); $checkquery = $db->execute("SELECT * FROM `users` WHERE `id`=?", $player->id); //$rec = mysql_fetch_array($checkquery); extract($_POST); $errors = 0; $errorlist = ""; if ($errors == 0) { $query = $db->execute("UPDATE `users` SET `stat_bonus`=? WHERE `id`=?", array($player->stat_bonus - $amount, $player->id)) or die("querya failed: ". mysql_error()); if($query) $qry = $db->execute("select * from `users` where `id`=?", array($player->id)) or die("qry failed: ".mysql_error()); $rw = $qry->fetchrow(); if($qry){ $query2 = $db->execute("UPDATE `users` SET `stat_bonus`=?, $choice=$choice+$amount WHERE `id`=?", array($player->stat_bonus - $amount, $player->id)) or die("query2 failed: ". mysql_error()); if($query2){ echo("<br><br>You have successfully used your stat bonus points.<br>"); } elseif ($amount > $player["stat_bonus"]) { echo "<font color='red'>Enter an amount higher than 0!</font>"; } elseif ($amount == 0) { echo "<font color='red'>Enter an amount higher than 0!</font>"; } elseif (!is_numeric($amount)) { echo "<font color='red'>Enter an amount!</font."; } else { echo "<font color=green><b>You have succesfully spend skill points!</b></font><br /><br />"; }}}} $player = check_user($secret_key, $db); ?> <table width="100%"> <tr> <td colspan="2"><fieldset> <form action="" method="post"> <font size='4'><b>Skill points</b></font><br /> Every time you raise a level, you get 3 skillpoints. You can spend them here. <br /> You currently have <font color=green><b><?=$player->stat_bonus?> Skill Points.</b></font>. Please choose an attribute:<br /> <br /> <INPUT TYPE="radio" NAME="choice" VALUE="strength" CHECKED>Strength<br /> <INPUT TYPE="radio" NAME="choice" VALUE="vitality" >Vitality<br /> <INPUT TYPE="radio" NAME="choice" VALUE="agility">Agility<br /> <INPUT TYPE="radio" NAME="choice" VALUE="wisdom">Wisdom<br /> <br /> How many skill points do you want to spend? (+1 for every skill point): <br /><br /> Amount: <INPUT TYPE="text" NAME="amount" SIZE="8" MAXLENGTH="8"> <INPUT TYPE="submit" NAME="statbonus" VALUE="Submit"> </form></fieldset></td></tr> </table> This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=316783.0 |