Birdmansplace Posted December 6, 2008 Share Posted December 6, 2008 I have spent many hours trying to figure this out. I have my basic little form for my web site and i want to not have it email me the info collected. I a total noob to php. That i am trying to do is have the collected info write to a text file or csv file then display that info in another page. Its for my donation page of my site and want the user to enter there name, about donated, and date. the after they submit it they get redirected to a page that holds a list of everyone that has donated to the site and if its possible to have a sum of month my month to. Check out my site:birdmansplace.myftp.org Quote Link to comment Share on other sites More sharing options...
ratcateme Posted December 6, 2008 Share Posted December 6, 2008 for better records i would advise you to use a mysql database. they are a lot easier to handle things like that and are not to hard to use. if you need some help with the code for it i would be happy to help. Scott. Quote Link to comment Share on other sites More sharing options...
Birdmansplace Posted December 6, 2008 Author Share Posted December 6, 2008 Scott. I could use all the help i can get. I will post anything that you my need to let me. Quote Link to comment Share on other sites More sharing options...
gevans Posted December 6, 2008 Share Posted December 6, 2008 Have you ever used mysql and php? Paste the code for your form also.. Quote Link to comment Share on other sites More sharing options...
Birdmansplace Posted December 6, 2008 Author Share Posted December 6, 2008 i used a site to generate my form. form.php <?php include_once( "20081205-1f518584e4764ab8107e3e4ae1d697e3.lib.php" ); ?> <html> <head> <title>Free Form Maker - PHP Forms</title> <meta http-equiv="Content-type" content="text/html; charset=iso-8859-1"> <meta name="keywords" content="free forms php form maker"> <meta name="description" content="build php forms with unlimited fields automatic validation, file attachments and auto-responder."> <style type='text/css'> .form_title{ color : #000000; font-size: 13px; font-family: verdana, Geneva, Arial, Helvetica, sans-serif; font-weight : bold; } .form_field { font-size : 13px; font-family : Verdana, Arial, Helvetica, sans-serif; color : #474747; font-weight : bold; text-align:left; } .form_text{ font-size : 11px; font-family : Verdana, Arial, Helvetica, sans-serif; color : #000000; } .text_box{ font-size : 11px; font-family : Verdana, Arial, Helvetica, sans-serif; color : #000000; width:200px; } .text_area{ font-size : 11px; font-family : Verdana, Arial, Helvetica, sans-serif; color : #000000; width:200px; height:60px; } .text_select{ font-size : 11px; font-family : Verdana, Arial, Helvetica, sans-serif; color : #000000; } .form_error{ font-size : 11px; font-family : Verdana, Arial, Helvetica, sans-serif; color : #ff0000; font-weight : bold; } .copyright{ font-size : 11px; font-family : Verdana, Arial, Helvetica, sans-serif; color : #000000; } </style> </head> <body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0"> <center> <meta http-equiv="content-type" content="text/html; charset="> <!-- Begin: Form Description --> <br><br><br> <table cellspacing='16' cellpadding='0' border='0' align='center' ><tr><td> <font class='form_title'></font> </td></tr></table> <!-- End: Your FormMail's Description --> <!-- Begin: Form --> <?php if( !$isHideForm ): global $sErr ; if( $sErr ) print "<br><a name='error'></a><center><font class='form_error' >$sErr</font></center><br>"; $starColor = $sErr ? "#ff0000" : "#000000"; $style=" class='form_text' "; ?> <form name="frmFormMail" action="<?php print PHP_SELF ?>" method='post' enctype='multipart/form-data'> <input type='hidden' name='formmail_submit' value='Y'> <input type='hidden' name='esh_formmail_subject' value="Donate"> <input type='hidden' name='esh_formmail_return_subject' value="Thank You"> <input type='hidden' name='esh_formmail_return_msg' value="Thank You for your donation from the Staff of Birdmans Place"> <table cellspacing='16' cellpadding='0' border='0' > <tr> <td class="form_field" valign='top' align='right'>User Name </td><td width='10' aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td> <td class="form_text"> <input type="text" name="User_Name" value="<?php print HtmlSpecialChars( $HTTP_POST_VARS[ "User_Name" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Amount Donated </td><td width='10' aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td> <td class="form_text"> <input type="text" name="Amount_Donated" value="<?php print HtmlSpecialChars( $HTTP_POST_VARS[ "Amount_Donated" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Date Donated </td><td width='10' aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td> <td class="form_text"> <?php selectList( "Date_Donated_MM", $HTTP_POST_VARS["Date_Donated_MM"], 1, 12, "MM", $style ) ; selectList( "Date_Donated_DD", $HTTP_POST_VARS["Date_Donated_DD"], 1, 31, "DD", $style ) ; selectList( "Date_Donated_YYYY", $HTTP_POST_VARS["Date_Donated_YYYY"], date("Y"), date("Y")+3, "YYYY", $style ) ; ?> </td> </tr> <tr><td colspan=3 align='center'><input type='submit' value='Submit'> <input type='button' value='Cancel' onclick="location.href='/';"></td></tr> </table> </form> <!-- End: --> <?php if( $sErr ) print "<script language='javascript' type='text/javascript'>location.href='#error';</script>";;; else: //!$isHideForm print( "<br><br><hr><center><b>Your form has been sent. Thank you.</b><br><br><input type='button' value='Home' onclick=\"location.href='/';\"></center><br><br>" ); endif; //!$isHideForm ?> <!-- footer --> <br /><br /> <div class='form_copyr'> Generated by : <a href="http://www.freeformmaker.com/" target="_blank">Free Form Maker</a> </div> <p> </p> </center> <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct = "UA-2637029-29"; urchinTracker(); </script> </body> </html> To see where is being used:birdmansplace.myftp.org/main/dform/donate.php Quote Link to comment Share on other sites More sharing options...
gevans Posted December 6, 2008 Share Posted December 6, 2008 can you put that in [ code ] [ /code ] tags?? makes it very hard to work with otherwise. and have you ever used mysql with php? Quote Link to comment Share on other sites More sharing options...
Birdmansplace Posted December 6, 2008 Author Share Posted December 6, 2008 No i haven't, this will be my first time. But i do know how to use mysql. meaning adding databases and tables but info in the tables. That i am lost with. Other than that i seek help. Also the code above it set to email me the content. but i would rather ahave it set up where i don't have to deal with it other then editing false entrys Quote Link to comment Share on other sites More sharing options...
gevans Posted December 6, 2008 Share Posted December 6, 2008 what's 20081205-1f518584e4764ab8107e3e4ae1d697e3.lib.php ?? Does this handle the form currently? Quote Link to comment Share on other sites More sharing options...
Birdmansplace Posted December 7, 2008 Author Share Posted December 7, 2008 i am guessing so. heres the code for that <?php error_reporting(E_PARSE); define("ADMIN_MAIL", "jb@bwp.net"); define("HOST_NAME", $_SERVER['HTTP_HOST']); define("PHP_SELF", $_SERVER['PHP_SELF']); define("ERR_MISSING", "Missing required field : "); define("ERR_EMAIL", "Please enter a valid e-mail address : "); define("ERR_CREDIT_CARD_NUMBER", "Please check the credit card number : "); define("ERR_CREDIT_CARD_EXPIRED", "Please check the credit card expiry date : "); define("ERR_SELECT_UPLOAD", "Please select file : ");// recipient define('FORM_RECIPIENT', 'birdmansplace@gmail.com'); // --- Array of Form Elements --- $form_mail[] = array( "name" => "User_Name", "text" => "User Name", "type" => "text", "required" => "Required" ) ; $form_mail[] = array( "name" => "Amount_Donated", "text" => "Amount Donated", "type" => "text", "required" => "Required" ) ; $form_mail[] = array( "name" => "Date_Donated", "text" => "Date Donated", "type" => "date(mm-dd-yyyy)", "required" => "Required" ) ; // -- Create new vars for checkPass() & sendFormMail() -- $HTTP_POST_VARS[ "Date_Donated" ] = ( $HTTP_POST_VARS[ "Date_Donated_YYYY" ] && $HTTP_POST_VARS[ "Date_Donated_MM" ] && $HTTP_POST_VARS[ "Date_Donated_DD" ] ) ? $HTTP_POST_VARS[ "Date_Donated_YYYY" ] . "-" . $HTTP_POST_VARS[ "Date_Donated_MM" ] . "-" . $HTTP_POST_VARS[ "Date_Donated_DD" ] : "" ; // -- Detech Submit & SendMail -- $isHideForm = false; if( $HTTP_POST_VARS["formmail_submit"] ){ $sErr = checkPass(); if( ! $sErr ){ sendFormMail( $form_mail, "donateform") ; $isHideForm = true; $redirect = ""; if( strlen(trim($redirect)) ): header( "Location:$redirect" ); exit; endif; } } ?> <? // =============================================== function sendFormMail( $form_mail, $sFileName = "" ) { global $HTTP_POST_VARS ; if (ereg('/freeformmaker.com/', HOST_NAME)) { return; } $to = FORM_RECIPIENT; $from = "NO_REPLY@" . HOST_NAME; $subject = $HTTP_POST_VARS["esh_formmail_subject"]; // first stage keep it simple: $sWhatToDo = $sFileName ? "mailandfile" : "" ; //$HTTP_POST_VARS["esh_formmail_mail_and_file"]; //$sFileName = $HTTP_POST_VARS["esh_formmail_save_record_file"]; $cc = $HTTP_POST_VARS["esh_formmail_cc"]; $bcc = $HTTP_POST_VARS["esh_formmail_bcc"]; $charset = $HTTP_POST_VARS["esh_formmail_charset"]; for( $i = 0; $i < count( $form_mail ); $i ++ ){ $value = trim( $HTTP_POST_VARS[ $form_mail[ $i ][ "name" ] ] ); $content .= $form_mail[ $i ][ "text" ] . " \t : " . $value ."\n"; $line .= remove_newline( $value ) . "\t" ; if( strtolower("Sender's email") == strtolower($form_mail[ $i ][ "type" ]) ) { //print "Type:[" . $form_mail[ $i ][ "type" ] . "] $value <br>\n"; $from = $value ; } }; $content .= "\n\nIP:" . getEnv( "REMOTE_ADDR" ); switch( strtolower($sWhatToDo) ){ case "mailandfile" : mailAttachments( $to , $subject , $content, $from, $charset, $cc , $bcc ) ; if( ! appendToFile( $sFileName, $line ) ) mailReport( $content . "\n\nWrite Form Mail to File Fail." ); break; case "fileonly" : if( ! appendToFile( $sFileName, $line ) ) mailReport( $content . "\n\nWrite Form Mail to File Fail.", $from ); break; default : mailAttachments( $to , $subject , $content, $from, $charset, $cc , $bcc ) ; } mailAutoResponse( $from ) ; } //------------------------------------------------------------------------------------------ function mailAutoResponse( $to ){ global $HTTP_POST_VARS ; $subject = $HTTP_POST_VARS["esh_formmail_return_subject"]; $responseMsg = $HTTP_POST_VARS["esh_formmail_return_msg"]; if( $to && $responseMsg ) mail( $to, $subject, $responseMsg, "From: " . FORM_RECIPIENT); } //------------------------------------------------------------------------------------------ function mailReport( $content = "", $from = "" ){ mail( ADMIN_MAIL, "Error@" . HOST_NAME . PHP_SELF, $content, "From:$from" ); } //------------------------------------------------------------------------------------------ function remove_newline( $str = "" ){ $newliner = "<!--esh_newline-->" ; // replace \r\n with $newliner ; $newtaber = "<!--esh_newtaber-->" ; // replace \t with $newtaber ; $str = ereg_replace( "\t", $newtaber, $str ); $str = ereg_replace( "\r\n", $newliner, $str ); return ereg_replace( "\n", $newliner, $str ); } //------------------------------------------------------------------------------------------ function checkPass() { global $form_mail ; global $HTTP_POST_VARS ; global $HTTP_POST_FILES ; for( $i = 0; $i < count( $form_mail ); $i ++ ){ $type = strtolower( $form_mail[ $i ][ "type" ] ); $value = trim( $HTTP_POST_VARS[ $form_mail[ $i ][ "name" ] ] ); $required = $form_mail[ $i ][ "required" ] ; $text = stripslashes( $form_mail[ $i ][ "text" ] ); // simple check the field has something keyed in. if( !strlen($value) && ( $required == "Required" ) && $type != "attachment" ) return ERR_MISSING . $text ; // verify the special case /*if( ( strlen($value) || $type == "attachment" ) && $required == "Required" ): */ switch( $type ){ case strtolower("Sender's Name") : break; case strtolower("Generic email"): //case strtolower("Sender's email"): case "email": if( ! formIsEMail($value) ) return ERR_EMAIL . $text ; break; case "text" : break; case "textarea" : break; case "checkbox" : case "radio" : break; case "select" : break; case "attachment" : $upload_file = $HTTP_POST_FILES[ $form_mail[ $i ]["name"] ][ "tmp_name" ] ; if( ! is_uploaded_file($upload_file) ) return ERR_SELECT_UPLOAD . $text; break; case strtolower("Date(MM-DD-YYYY)"): break; case strtolower("Date(MM-YYYY)"): break; case strtolower("CreditCard(MM-YYYY)"): if( $value < date("Y-m") ) return ERR_CREDIT_CARD_EXPIRED . $text; break; case strtolower("CreditCard#"): if( !formIsCreditNumber( $value ) ) return ERR_CREDIT_CARD_NUMBER . $text ; break; case strtolower("Time(HH:MM:SS)"): break; case strtolower("Time(HH:MM)"): break; default : //return $sErrRequired . $form_mail[ $i ][ "text" ]; } // switch //endif; } // for return "" ; } //------------------------------------------------------------------------------------------ function formSelected( $var, $val ) { echo ( $var == $val ) ? "selected" : ""; } //------------------------------------------------------------------------------------------ function formChecked( $var, $val ) { echo ( $var == $val ) ? "checked" : ""; } //------------------------------------------------------------------------------------------ function formIsEMail( $email ){ return ereg( "^(.+)@(.+)\\.(.+)$", $email ); } //------------------------------------------------------------------------------------------ function selectList( $name, $selectedValue, $start, $end, $prompt = "-Select-", $style = "" ) { $tab = "\t" ; print "<select name=\"$name\" $style>\n" ; print $tab . "<option value=''>$prompt</option>\n" ; $nLen = strlen( "$end" ) ; $prefix_zero = str_repeat( "0", $nLen ); for( $i = $start; $i <= $end ; $i ++ ){ $stri = substr( $prefix_zero . $i, strlen($prefix_zero . $i)-$nLen, $nLen ); $selected = ( $stri == $selectedValue ) ? " selected " : "" ; print $tab . "<option value=\"$stri\" $selected >$stri</option>\n" ; } print "</select>\n\n" ; } //------------------------------------------------------------------------------------------ // something like CreditCard.pm in perl CPAN function formIsCreditNumber( $number ) { $tmp = $number; $number = preg_replace( "/[^0-9]/", "", $tmp ); if ( preg_match( "/[^\d\s]/", $number ) ) return 0; if ( strlen($number) < 13 && 0+$number ) return 0; for ($i = 0; $i < strlen($number) - 1; $i++) { $weight = substr($number, -1 * ($i + 2), 1) * (2 - ($i % 2)); $sum += (($weight < 10) ? $weight : ($weight - 9)); } if ( substr($number, -1) == (10 - $sum % 10) % 10 ) return $number; return $number; } // -------------------------- Begin Mail Attachment Functions ----------------------------------------------------------------- function mailAttachments( $to = "" , $subject = "" , $message = "" , $from = "support@lynx.net" , $charset = "iso-8859-1", $cc = "" , $bcc = "" ){ global $HTTP_POST_FILES ; if( ! strlen( trim( $to ) ) ) return "Missing \"To\" Field." ; $boundary = "====_My_PHP_Form_Generator_" . md5( uniqid( srand( time() ) ) ) . "===="; // setup mail header infomation $headers = "From: $from\r\n"; if ($cc) $headers .= "CC: $cc\r\n"; if ($bcc) $headers .= "BCC: $bcc\r\n"; $plainHeaders = $headers ; // for no attachments header $headers .= "MIME-Version: 1.0\nContent-type: multipart/mixed;\n\tboundary=\"$boundary\"\n"; $txtMsg = "\nThis is a multi-part message in MIME format.\n" . "\n--$boundary\n" . "Content-Type: text/plain;\n\tcharset=\"$charset\"\n\n" . $message . "\n"; //create mulitipart attachments boundary $sError = "" ; $nFound = 0; foreach( $HTTP_POST_FILES as $aFile ){ $sFileName = $aFile[ "tmp_name" ] ; $sFileRealName = $aFile[ "name" ] ; if( is_file( $sFileName ) ): if( $fp = fopen( $sFileName, "rb" ) ) : $sContent = fread( $fp, filesize( $sFileName ) ); $sFName = basename( $sFileRealName ) ; $sMIME = getMIMEType( $sFName ) ; $bPlainText = ( $sMIME == "text/plain" ) ; if( $bPlainText ) : $encoding = "" ; else: $encoding = "Content-Transfer-Encoding: base64\n"; $sContent = chunk_split( base64_encode( $sContent ) ); endif; $sEncodeBody .= "\n--$boundary\n" . "Content-Type: $sMIME;\n" . "\tname=\"$sFName\"\n" . $encoding . "Content-Disposition: attachment;\n" . "\tfilename=\"$sFName\"\n\n" . $sContent . "\n" ; $nFound ++; else: $sError .= "<br>File $sFileName can not open.\n" ; endif; // if( $fp = fopen( $sFileName, "rb" ) ) : else: $sError .= "<br>File $sFileName doesn't exist.\n" ; endif; //if( file_exists( $sFileName ) ): }; // end foreach $sEncodeBody .= "\n\n--$boundary--" ; $sSource = $txtMsg . $sEncodeBody ; $nFound ? mail( $to, $subject, $sSource, $headers ) : mail( $to, $subject, $message, $plainHeaders ); return $sError ; } /* --------------------------------------------------------------------------------------------------- Parameters: $sFileName Return : 1. "" : no extendsion name, or sFileName is empty 2. string: MIME Type name of array aMimeType's definition. ---------------------------------------------------------------------------------------------------*/ function getMIMEType( $sFileName = "" ) { $sFileName = strtolower( trim( $sFileName ) ); if( ! strlen( $sFileName ) ) return ""; $aMimeType = array( "txt" => "text/plain" , "pdf" => "application/pdf" , "zip" => "application/x-compressed" , "html" => "text/html" , "htm" => "text/html" , "avi" => "video/avi" , "mpg" => "video/mpeg " , "wav" => "audio/wav" , "jpg" => "image/jpeg " , "gif" => "image/gif" , "tif" => "image/tiff " , "png" => "image/x-png" , "bmp" => "image/bmp" ); $aFile = split( "\.", basename( $sFileName ) ) ; $nDiminson = count( $aFile ) ; $sExt = $aFile[ $nDiminson - 1 ] ; // get last part: like ".tar.zip", return "zip" return ( $nDiminson > 1 ) ? $aMimeType[ $sExt ] : ""; } // End Mail Attachment Functions //------------------------------------------------------------------------------------------ function appendToFile( $sFileName = "", $line = "" ){ if( !$sFileName || !$line ) return 0; $hFile = fopen( "$sFileName", "a+w" ); $nBytes = 0; if( $hFile ){ $nBytes = fputs( $hFile , trim($line)."\r\n" ); fclose( $hFile ); }; return $nBytes ; } ?> Quote Link to comment Share on other sites More sharing options...
Birdmansplace Posted December 7, 2008 Author Share Posted December 7, 2008 Well i have managed to find that the form is also logging in a text file. Know i just need to know how i can get the list to show i a page listing the newest data at the top of the list and each submisson to apear in one line. Quote Link to comment Share on other sites More sharing options...
webmaster1 Posted December 7, 2008 Share Posted December 7, 2008 One step at a time. Have you managed to succesfully write the data to a file/database? Quote Link to comment Share on other sites More sharing options...
Birdmansplace Posted December 7, 2008 Author Share Posted December 7, 2008 I gave up on trying to figure it out. and know the i messed around with my form its not working write again so know i have to redo it. my dumb self forgot to make a back up copy. Quote Link to comment Share on other sites More sharing options...
webmaster1 Posted December 7, 2008 Share Posted December 7, 2008 Take a deep breath. We can help. Lets start from the start. How many fields does your form have? In a nutshell what is it supposed to do? Quote Link to comment Share on other sites More sharing options...
Birdmansplace Posted December 7, 2008 Author Share Posted December 7, 2008 My for has 3 items. User name, Donation amount, and date. what i want is when a user of my site enters this info that its stored by .txt file or in database and then have a webpage pull this info and display it for everyone to view. and in the webpage i would like it to look like this. newest listed first date, amount and user can be moved around to make it easyer user2 $10.00 01-01-2009 user1 $10.00 12-31-2008 and so on. Quote Link to comment Share on other sites More sharing options...
webmaster1 Posted December 7, 2008 Share Posted December 7, 2008 This is very straightfoward. I can help you with creating the form, writing to a database and outputting the results to a page. I can't help you however with whatever it is you using to take payment. Are you satisified that you can take payment yet? Quote Link to comment Share on other sites More sharing options...
Birdmansplace Posted December 7, 2008 Author Share Posted December 7, 2008 payment is not an issue. i am asking my users to fill out the form after donating through a link to paypal. all i want is 3 text fields that will display in a page. So for what you said you would help with is the only thing i need. The "real" payment is not handled with the form. So i am all hears for you help. i do have a basic form that i already have started. but i have to figure out how to change whats showing. birdmansplace.myftp/test/index.php Quote Link to comment Share on other sites More sharing options...
webmaster1 Posted December 7, 2008 Share Posted December 7, 2008 Alritey, link doesn't work btw. Give me a few minutes to write out a basic script. Quote Link to comment Share on other sites More sharing options...
Birdmansplace Posted December 7, 2008 Author Share Posted December 7, 2008 thanks, i forgot .org in the link Quote Link to comment Share on other sites More sharing options...
webmaster1 Posted December 7, 2008 Share Posted December 7, 2008 I'm assuming that you're new to php. Correct me if I'm wrong. Here's the form less its layout and styling. Try working with just this before integrating it into your actual page. Create a page named form.php and paste in the following: <?php if (isset($_POST['submit'])) { if (strlen($_POST['username']) > 0) {$username=TRUE;} else {$username=FALSE; $message_username="* You forgot to enter the username!";} if (strlen($_POST['amount']) > 0) {$amount=TRUE; if (is_numeric($_POST['amount'])) {$amountnumericcheck=TRUE;} else {$amountnumericcheck=FALSE; $message_amountnumericcheck=" *Please enter numeric values only!"; //echo "$message_amountnumericcheck"; } } else {$price=FALSE; $message_amount=" *You forgot to enter the amount!";} if ($username && $amount) { //YOU NEED TO HAVE AN EXTERNAL PHP FILE WITH YOUR DATABASE CONNECTION DETAILS. LET ME KNOW IF YOU DON'T KNOW HOW include("dbinfo.php"); mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to establish a connection to the relevant database."); $username = mysql_real_escape_string($_POST['username']); $amount = mysql_real_escape_string($_POST['amount']); $ipaddress = getenv('REMOTE_ADDR'); $now_datetime = date('Y-m-d h:i:s'); $query = "INSERT INTO tablename VALUES ('','$username','$amount','$ipaddress',NOW())"; mysql_query($query); echo "Thank you $username !"; exit(); } } ?> <html> <body> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data"> Username:<input type="text" name="username" id="username" value="<?php if (isset($_POST['username'])) echo $_POST['username']; ?>"/> <?php if ($message_username) echo ''.$message_username.''; ?> </br> Amount:<input type="text" name="amount" id="amount" value="<?php if (isset($_POST['amount'])) echo $_POST['amount']; ?>"/> <?php if ($message_amount) echo ''.$message_amount.''; ?> </br> <!---NO NEED FOR USER TO MANUALLY INPUT DATE FIELD, MYSQL WILL CAPTURE THIS FOR YOU AUTOMATICALLY-> <input type="submit" name="submit" id="submit" value="Submit Details"> </form> </body> </html> Next we need to create a database that recieves the information. Do you want me to walk you through this? ***Please note I just edited the above code. Just a few typos with variables. Now fixed. Quote Link to comment Share on other sites More sharing options...
Birdmansplace Posted December 7, 2008 Author Share Posted December 7, 2008 that would be helpfull. I already have a database named form. Quote Link to comment Share on other sites More sharing options...
webmaster1 Posted December 7, 2008 Share Posted December 7, 2008 Righto. Do you use cpanel and myPHPadmin? Quote Link to comment Share on other sites More sharing options...
Birdmansplace Posted December 7, 2008 Author Share Posted December 7, 2008 just phpmyadmin Quote Link to comment Share on other sites More sharing options...
webmaster1 Posted December 7, 2008 Share Posted December 7, 2008 No probs. Here's the SQL to create your table: CREATE TABLE `yourdatabasename`.`yourtablename` ( `urn` INT( 100 ) NOT NULL AUTO_INCREMENT , `username` VARCHAR( 100 ) NOT NULL , `amount` VARCHAR( 100 ) NOT NULL , `ipaddress` VARCHAR( 100 ) NOT NULL , `date` DATETIME NOT NULL , PRIMARY KEY ( `urn` ) ) ENGINE = MYISAM Quote Link to comment Share on other sites More sharing options...
webmaster1 Posted December 7, 2008 Share Posted December 7, 2008 Then create a file named dbinfo.php and paste in the following: <?php $host = 'localhost'; //usually localhost $username = 'yourusername'; //your username assigned to your database $password = 'yourpassword'; //your password assigned to your user & database $database = 'yourdatabasename'; //your database name ?> Make sure its in the same path as form.php. Try submitting something into your form. You should now see the values appear in your database. Thats the input and half the battle done. As soon as you give me the all clear we can move on to the output. Quote Link to comment Share on other sites More sharing options...
Birdmansplace Posted December 7, 2008 Author Share Posted December 7, 2008 No probs. Here's the SQL to create your table: CREATE TABLE `yourdatabasename`.`yourtablename` ( `urn` INT( 100 ) NOT NULL AUTO_INCREMENT , `username` VARCHAR( 100 ) NOT NULL , `amount` VARCHAR( 100 ) NOT NULL , `ipaddress` VARCHAR( 100 ) NOT NULL , `date` DATETIME NOT NULL , PRIMARY KEY ( `urn` ) ) ENGINE = MYISAM import and this will create db or import into the db to create the tables? 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.