PHP - Splitting Sign-up Form Over Several Pages
Similar TutorialsHello I am after some help with a concept to allow us to import some data into our database. I have a PDF which I have OCR'd and now have a word document... I then manually clean up the document to remove spurious characters, that part is fine. Now, the word document contains an unknown number of lines and an unknown number of records... and within those records an uknown number of fields... Here is an example of a single record: Mr G Aldred, 26/11/08, Canvardine Chance, Wolfies Dawn Tilley, KENINE SECRET DESTINY, d, c. Grey & White, KENINE SHADES OF THE NIGHT, d, c. Grey & White, KENINE SILENT WHISPER, b, c. Seal & White, KENINE SOFT KISSES, b, c. Grey & White, KENINE SPIRIT OF THE STORM, d, c. Seal & White KENINE STAR QUALITY, d, c. Seal & White And I could have multiple records like this, but with different number of names toward the end So, if I manually put some delimiting character instead of coma's , can I get PHP to read the WHOLE document in, split the document into records and then split those records into subfields to populate a form which I can then automatically submit to my database? Not sure if that is clear.... Thanks Hello: I wanted to see if I can make my password protected pages in my admin area, and the login form "more secure." I was told I should use MD5 / SALTING / HASHING to do this. I have tried some online tutorials, but am not understanding it, so I wanted to start from what I have and build upon it> This is my database table storing the myAdmins data (when I initially insert it into the database): Code: [Select] CREATE TABLE `myAdmins` ( `id` int(4) NOT NULL auto_increment, `myUserName` varchar(65) NOT NULL default '', `myPassword` varchar(65) NOT NULL default '', PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; INSERT INTO myAdmins VALUES("1","abc","123"); This is the login form I use: Code: [Select] <?php include('../include/myConn.php'); include('include/myAdminNav.php'); session_start(); session_destroy(); $message=""; $Login=$_POST['Login']; if($Login){ $myUserName=$_POST['myUserName']; $myPassword=$_POST['myPassword']; $result=mysql_query("select * from myAdmins where myUserName='$myUserName' and myPassword='$myPassword'"); if(mysql_num_rows($result)!='0'){ session_register("myUserName"); header("location:a_Home.php"); exit; }else{ $message="<div class=\"myAdminLoginError\">Incorrect Username or Password</div>"; } } ?> <form id="form1" name="form1" method="post" action="<? echo $PHP_SELF; ?>"> <? echo $message; ?> Username: <input name="myUserName" type="text" id="myUserName" size="40" /> Password: <input name="myPassword" type="password" id="myPassword" size="40" /> <input name="Login" type="submit" id="Login" value="Login" /> </form> This is the code on top of each page I password protect: Code: [Select] <? session_start(); if(!session_is_registered(myUserName)){ header("location:Login.php"); } ?> Works well, but can it be "better"?? And, if I am allowing the admin to update his/her username or password, I do it this way: Code: [Select] <?php include('../include/myConn.php'); include('include/myCheckLogin.php'); if ($_SERVER['REQUEST_METHOD'] == 'POST') { $myUserName = mysql_real_escape_string($_POST['myUserName']); $myPassword = mysql_real_escape_string($_POST['myPassword']); $sql = " UPDATE myAdmins SET myUserName = '$myUserName', myPassword = '$myPassword' "; mysql_query($sql) && mysql_affected_rows() ?> <?php } $query=mysql_query("SELECT * FROM myAdmins") or die("Could not get data from db: ".mysql_error()); while($result=mysql_fetch_array($query)) { $myUserName=$result['myUserName']; $myPassword=$result['myPassword']; } ?> <form method="post" action="<?php echo $PHP_SELF;?>"> <input type="hidden" name="POSTBACK" value="EDIT"> Username: <input type="text" size="60" maxlength="60" name="myUserName" value="<?php echo $myUserName; ?>"> Password: <input type="password" size="60" maxlength="60" name="myPassword" value="<?php echo $myPassword; ?>"> <input type="submit" value="Submit" /> </form> Should it be "better" .. ?? I don't seem to understand how to "encrypt" all of this to make it "stronger" .. Ideas? Improvements? I have an ordering process that consists of 3 pages: 1) Page1: Enter name/address 2) Page2: Based on address, determine availability of products, and let user choose which products, how many, etc. 3) Page3: Enter credit card info to send to the processor What is the best way to store information fro page 1 to page 2, then from page 2 to page 3? I thought about just using hidden fields. Is this OK? Is there another preferred way? Thanks! Following is the form.Now i want to see if submit button is pressed or not.Usually if html had Code: [Select] <input type="submit" value="Submit" name = "submit" /> i would simply use Code: [Select] <?php if(isset($_POST['submit'])) ?> But below is the form which has an image as a submit button Form - Code: [Select] <form action="" method="post" id="sendemail"> <ol> <li> <label for="name">Name (required)</label> <input id="name" name="name" class="text" /> </li> <li> <label for="email">Email Address (required)</label> <input id="email" name="email" class="text" /> </li> <li> <label for="email">Phone number</label> <input id="phone" name="phone" class="text" /> </li> <li> <label for="address">Address(required)</label> <input id="address" name="address" class="text" /> </li> <li> <label for="city">City(required)</label> <input id="city" name="city" class="text" /> </li> <li> <label for="state">State(required)</label> <input id="state" name="state" class="text"/> </li> <li> <label for="zipcode">Pincode/Zipcode(required)</label> <input id="zipcode" name="zipcode" class="text" /> </li> <li> <input type="image" name="submit" id="imageField" src="images/submit.gif" class="send" /> <div class="clr"></div> </li> </ol> </form> How should i check if form is submitted or not when instead of submit button there is an image ? ----------------------------------------------------------------- Alternative Solution ---------------------------------------------------------------------------- I tried sending it to other page but then i had to send an array back to this page and i didn't know how to send that either.I tried Code: [Select] <?php $error = serialize($error); echo "<meta http-equiv='refresh' content='0;url=about.php?array=".$error."'> "; ?> But even after Code: [Select] $array = unserialize($array); $array contained nothing. Can someone please show me how to send in array in between pages for future ? In the code below, I am trying to produce a google-like page where the user can type keywords and pages of search results are displayed. The main difficulty I am encountering is that when the browser changes pages, it forgets everything about current data. Perhaps I should include the display of pages inside the HTML form ? How can I fix this code ? Here is the contents of my searchpage.php file : <?php $keywords=''; $display_search_results=''; if(isset($_POST['search_submitted'])) { $keywords=$_POST['keywords']; $search_results=array(); $totalNbrOfItems=20; for($k=1;$k<=$totalNbrOfItems;$k++) { $search_results[$k]='Your keywords '$keyowrds.' have been found in item number '.$k; } $nbrOfItemsParPage = 5; $nbrOfPages = ceil($totalNbrOfItems / $nbrOfItemsParPage); // Compute current page $current_page = (isset($_GET['page']))?intval($_GET['page']):1; $display_pages=($nbrOfPages<2)?'<p>Page : ':'<p>Pages : '; for ($i = 1 ; $i <= $nbrOfPages ; $i++) { if ($i == $current_page) //No link to the current page { $display_pages=$display_pages.$i.' '; } else { $display_pages=$display_pages.'<a href="searchpage.php?'. 'page='.$i.'">'. $i . '</a> '; } } $display_pages=$display_pages.'</p>'; $display_items=''; $start=$nbrOfItemsPerPage*($current_page-1); for($k=1;$k<=$nbrOfItemsParPage;$k++) { $display_items=$display_items.($search_results[$start+$k]).'<br>'; } $display_search_results=$display_pages.$display_items; } echo '<form method="post" action="searchpage.php">'. ' Type your keywords here : <br><br>'. '<textarea cols="65" rows="1" '. 'id="keywords_id" name="keywords">'.$keywords.'</textarea>'. '<input type="submit" name="search_submitted" id="search_submitted_id" value="Search" /> '. '</fieldset>'. '</form>'; echo $display_search_results; ?> Hi, We currently have an RSA key in XML format, and am trying to sign it with PHP and phpseclib, however we are struggling to do it. We have managed to decrypt and encrypt it, but can not find a way to sign it. They key has been generated with .NET. Cheers Hello, The number sign does not seem to be showing up after a GET request. I've set up a script for an example: text.php: Code: [Select] <?php session_start(); mysql_connect("localhost", "*****", "*******************9") or die(mysql_error()); mysql_select_db("*****") or die(mysql_error()); function safe($var) { $var=mysql_real_escape_string(addslashes(htmlspecialchars($var, ENT_QUOTES, 'UTF-8'))); return $var; } $N=safe($_GET['N']); echo"$N"; ?> Say the url is text.php?N=### None of the symbols show up. Thankyou, GB. So this is how the data is returned for the API I'm using:
REC INFO[p!]=p EXP DATE[p43]=03-20-15 PCODE1[p44]=1 PCODE2[p45]=uSo I'm trying to filter on either of the keys like 'PCODE2[p45]' or 'PCODE1[p44]'.. I'm trying to get the value after the equal sign, but still remain on the same line. So if I were searching by the p45 key, I would get 'u'. If I was searching by the p44 key I would get 1.. Is there a simple regex or something that would allow me to achieve these results? Thank you for any help! Okay, here's what I'm doing. It's sort of like a market script. When someone wants to buy something, they choose from a drop down the item they wish to buy. However, there is a setup cost for it to be started. Then, based upon the length they choose (anywhere from 1 - 12 months), the cost will add up. My questions a Is it possible to assign a setup cost? How can I make it so that, while some things will be, say $2 a month, others will be $3 or other amounts? Here's what I have so far, to try and figure this out. Feel free to laugh... Or if you could point me to an example of something like this, I'd be very appreciative! Thanks!! function ChangeInitialCost(){ $cic = ($_POST['newpremium']); if (($cic == "clan") || ($cic == "guild") || ($cic == "house") || ($cic == "militia")){ } And the form I have: (I haven't entered a submit button yet...) Code: [Select] <table width="200" border="1"> <form action="premium.php" method="post" name="purchase"> <tr> <td>Premium:</td> <td><select id="newpremium" name="newpremium"> <option value="casino">Casino</option> <option value="clan">Clan</option> <option value="guild">Guild</option> <option value="house">House</option> <option value="militia">Militia</option> </select></td></form> </tr> <tr><form action="premium.php" method="post" name="length"> <td>Length:</td> <td><select id="length" name="length"> <option value="0">-----</option> <option value="1">One Month</option> <option value="2">Two Months</option> <option value="3">Three Months</option> <option value="4">Four Months</option> <option value="5">Five Months</option> <option value="6">Six Months</option> <option value="7">Seven Months</option> <option value="8">Eight Months</option> <option value="9">Nine Months</option> <option value="10">Ten Months</option> <option value="11">Eleven Months</option> <option value="12">Twelve Months</option> </select></td></form> </tr> <tr> <td>Cost:</td> <td>SOME TYPE OF FUNCTION</td> </table> Heya guys! What's up? OK here's my problem: I got a variable, $var1, which is to have values like "groan,100,200,350,50" I need to know how to split this $var1 into $split1, $split2, $split3, $split4, $split5, where $split1 = "groan"; $split2 = "100"; $split3 = "200"; $split4 = "350"; $split5 = "50"; Thanks in advance people! P.S. In my case I am going to use some of the values for calculations. So I don't think that its easy with arrays, which are difficult for me to understand . P.S.S. When I am retrieving data from the database, many variables like $var1 that need to be split are being extracted. I hope that you understand. Thanks and Regards, Thauwa http://mobsters-fb-apache-dynamic-lb.playdom.com/mob_fb/get_hit_list?user_id=100000952273457&target_id=100000556624340&level=300&auth_key=cb07c7575b38df48d82dd53619385faa884db5a2 When going to this URL, it gives entries between <entry> and </entry>, what I am trying to do, is collect the <user_id> ONLY if the <amount> is over a certain value. Any ideas to how I could do this (I am a complete PHP noob). All help is appreciated I am having an issue with £ that i have in my database showing on my webpage as a triangle ?. I have my database encoded as utf8_general_ci and i declare <meta charset="UTF-8"> in my head. Is there something that i am missing here? Help is appreciated. Kind Regards Adam I've been looking for a way to do this for a long time. I have a simple(ish) login system, and I want to allow users to login with Twitter or Facebook; How can I do this? I'm pretty experienced at PHP and MySQL, but I really don't understand the API of either of the social networking sites. If you only know how the API for one of the sites, that'd be great too. I am coding using php and I am adding a pound sign in my mysql table but it outputs as a question mark, how do I make it output the pound sign? thanks. Hi there, im trying to create a sign up page for my site! I have used confirm password and email fields on the form but the code still shows the error message even if the passwords and emails match! Can anyone advice me please? Okay I need a little bit of help on this as strings constantly confuse me and reading tutorials actually got me a bit more loss then before. I have developed this mod that has become pretty popular and I'm debugging it. What I have are two variables. $username (The user's username, no html markup in it) $musername (The user's username, with html markup in it) So for example: $musername = <b><u>$username</u></b> The php code above would be the equivolant to what $musername is equal to. What I need to do is create an array or two variables, whatever is easier and grab all that html markup. The first variable would be all the html or anything really before the $username variable, and the other would take all of that html after the $username variable. I need to store those html markups in either two seperate variables or an array so i can call upon it later in the script. I need this to fix a bug issue. I have a string like this: Code: [Select] Something,Somthing Else,"keyword1,keyword2,keyword3",Yet another I need to split that string by the ,. However, I need the data that is n the quotes to remain as one even though it has commas because it is one item. I assume I need to use preg_split and have tried some code but none of it seems to work properly. If anyone has a better method or knows how I can split this up using preg_split the help is appreciated. I could use some suggestions on how to break up my HTML and PHP. Currently I have a file called "payment_form.php" It looks like this... Code: [Select] <body> <?php // HANDLE FORM. if (isset($_POST['submitted'])){ // Handle Form. // Determine if any errors. if (empty($errors)){ // Process Payment. // PHP code to send payment to Payment Gateway... // Do not return to Payment Form!!! exit(); } } ?> <!-- HTML PAYMENT FORM --> <form id="payment" action="" method="post"> <fieldset> <legend>Billing Details</legend> <ol> <!-- First Name --> <li> <label for="firstName">First Name:</label> <input id="firstName" name="firstName" class="text" type="text" maxlength="20" value="<?php echo $firstName; ?>" /> <?php if (!empty($errors['firstName'])){ echo '<span class="error">' . $errors['firstName'] . '</span>'; } ?> </li> I would like to keep the Form Validation PHP in the same file as the HTML Form so the user isn't ping-ponged between two pages if they make data entry errors. However, I am thinking it would be better to break out the Payment Processing PHP and place that in a different file. How should I do that? Maybe I could add a Redirect after this code... Code: [Select] if (empty($errors)){ // Process Payment. // PHP code to send payment to Payment Gateway... Suggestions welcome!! Thanks, Debbie Hi guys Say for example I have a text field with value 20/10/2011 how do I define it so that $x=20, $y=10 and $z=2011 so that I have three variables Thanks The sample string is KmSO4 Every upper case alphabet should be identified and splitted until another upper case alphabet comes. the string should be splitted so that output array looks like this Array ( => Km [1] => S [2]=>O4 ) can any one help regarding this issue? |