Jump to content

alphaboss

Members
  • Posts

    9
  • Joined

  • Last visited

alphaboss's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. I updated the php code to make it loop through the array of files but still not received any attachment in email here is the updated code: <?PHP /* Contact Form from HTML Form Guide This program is free software published under the terms of the GNU Lesser General Public License. See this page for more info: http://www.html-form-guide.com/contact-form/contact-form-attachment.html */ require_once("./include/fgcontactform.php"); $formproc = new FGContactForm(); //1. Add your email address here. //You can add more than one receipients. $to = $formproc->AddRecipient('test@alphaboss.ca'); //<<---Put your email address here $subject = 'Form was submitted'; $message = 'New message from a visitor'; $headers = 'From: test@alphaboss.ca' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); // 'test@alphaboss.ca', 'Form was submitted', 'New message from a visitor' //2. For better security. Get a random tring from this link: http://tinyurl.com/randstr // and put it here $formproc->SetFormRandomKey('HG9hPBpn9Bn26yg'); $formproc->AddFileUploadField('photo','jpg,jpeg,gif,png,bmp',2024); if(isset($_FILES ['name'])) if(isset($_FILES ['photo'])) if(count($_FILES['name']['photo'])) { foreach ($_FILES['name']['photo'] as $file) { if(isset($_FILES['submit'])){ // Count total files $countfiles = count($_FILES['photo']['name']); // Looping all files for($i=0;$i<$countfiles;$i++){ $file = $_FILES['photo']['name'][$i]; // Upload file move_uploaded_file($_FILES['photo']['tmp_name'][$i],'submit/'.$file); } } //do your upload stuff here echo $file; } } if(isset($_POST['submitted'])) { if($formproc->ProcessForm()) { $formproc->RedirectToURL("thank-you.php"); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"> <head> <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/> <title>Alpha Boss Computer Services</title> <style> body {font-family: Verdana, sans-serif; margin: 0; height: 1140px; } h1 {text-align:center; color: navy; } #background-image { background-image: url(alpha.png); width: 100%; top: 0; left: 0; height:1140px; opacity: 0.2; position: absolute; background-repeat: repeat; padding: 0; margin: 0; z-index:0; } .navbar { overflow: hidden; background-color: #333; position: fixed; bottom: 0; width: 100%; display: flex; align-items: center; justify-content: center; z-index: 2; } .navbar a { display: inline-block; color: #f2f2f2; text-align: center; padding: 14px 16px; text-decoration: none; font-size: 17px; margin: 0px auto; } .navbar a:hover { background: #f1f1f1; color: black; } .fieldset-auto-width { display: inline-block; } form { position: absolute; z-index: 2; left: 50px; right: 50px; top: 195px; } div.b { line-height: 1.6; } </style> <link rel="STYLESHEET" type="text/css" href="contact.css" /> <script type='text/javascript' src='scripts/gen_validatorv31.js'></script> <script type='text/javascript' src='scripts/fg_captcha_validator.js'></script> <link rel="icon" href="http://localhost/alpha.png" type="image/png" sizes="16x16"> </head> <body> <div id="background-image"></div> <!-- Form Code Start --> <div class="b"><h1>You can call <u>289-696-7530</u> or fill out the contact form below; for your computer, peripheral, and photo slideshow needs. Hours of operation: Monday to Friday 9AM to 5PM.</h1></div> <div class="form"><center><form id='contactus' action='<?php echo $formproc->GetSelfScript(); ?>' method='post' enctype="multipart/form-data" accept-charset='UTF-8'> <fieldset class="fieldset-auto-width"> <legend><h1>Contact Form</h1></legend> <input type='hidden' name='submitted' id='submitted' value='1'/> <input type='hidden' name='<?php echo $formproc->GetFormIDInputName(); ?>' value='<?php echo $formproc->GetFormIDInputValue(); ?>'/> <input type='text' class='spmhidip' name='<?php echo $formproc->GetSpamTrapInputName(); ?>' /> <div class='short_explanation'><font size="3" color="navy"><h1>* required fields</h1></font></div> <div><span class='error'><?php echo $formproc->GetErrorMessage(); ?></span></div> <div class='container'> <label for='name'><font size="3" color="navy"><h1>Your Full Name Below*:</h1></font></label><br/> <input style='width:400px;height:40px;font-size:14pt; border:3px solid black' type='text' name='name' id='name' value='<?php echo $formproc->SafeDisplay('name') ?>' maxlength="50" /><br/> <span id='contactus_name_errorloc' class='error'></span> </div> <div class='container'> <label for='email'><font size="3" color="navy"><h1>Your Email Address Below*:</h1></font></label><br/> <input style='width:400px;height:40px;font-size:14pt; border:3px solid black' type='text' name='email' id='email' value='<?php echo $formproc->SafeDisplay('email') ?>' maxlength="50" /><br/> <span id='contactus_email_errorloc' class='error'></span> </div> <div class='container'> <label for='message'><font size="3" color="navy"><h1>Your Message Below:</h1></font></label><br/> <span id='contactus_message_errorloc' class='error'></span> <textarea rows="10" cols="50" name='message' id='message' style="border:3px solid black"><?php echo $formproc->SafeDisplay('message') ?></textarea> </div> <div class='container'> <label for='photo'><font size="3" color="navy"><h1>Upload your photos:</h1></font></label><br/> <input style='font-size:24px' type="file" name='photo[]' id='photo' multiple=""/><br/> </div> <div class='container'> <input style='font-size:24px' type='submit' name='Submit' value='Submit' /> </div> </fieldset> </form></center></div> <div class="navbar"> <div class="navbar-inner"> <a href="index.html">HOME</a> <a href="https://www.facebook.com/Alpha-Boss-Computer-Services-1259286717548256/">FACEBOOK PAGE</a> </div> </div> <!-- client-side Form Validations: Uses the excellent form validation script from JavaScript-coder.com--> <script type='text/javascript'> // <![CDATA[ var frmvalidator = new Validator("contactus"); frmvalidator.EnableOnPageErrorDisplay(); frmvalidator.EnableMsgsTogether(); frmvalidator.addValidation("name","req","Please provide your name"); frmvalidator.addValidation("email","req","Please provide your email address"); frmvalidator.addValidation("email","email","Please provide a valid email address"); frmvalidator.addValidation("message","maxlen=2048","The message is too long!(more than 2KB!)"); frmvalidator.addValidation("photo","file_extn=jpg;jpeg;gif;png;bmp","Upload images only. Supported file types are: jpg,gif,png,bmp"); // ]]> </script> </body> </html> Are there any ideas as what I am doing wrong here and what to do to fix it?
  2. I don't think that I was perfectly clear with my question that I wanted to ask when it comes to uploading multiple files in php to be submitted to an email. For one line in my code which is: $formproc->AddFileUploadField('photo','jpg,jpeg,gif,png,bmp',2024); I am only adding one photo to this line. I want to change it so it is looping through the array of files and adding multiple photos instead. I am not to sure how to go about it though. Plus I also changed $_POST to $_FILES for my file type inputs. Any ideas of how to change it for the looping I hope that this clears up the question for you thanks in advance.
  3. Hello everyone I am trying to see if I can receive multiple photos at once from my contact php form to my thunderbird email when I go to my contact php form I click choose files and I highlight the photos that I want to send then I submitted form with those photos that I chosen then I checked my thunderbird email and I did receive the email from the contact form submitted but did not receive any file attachment. I have included the php code from the contact form any idea as what might be problem for this any help and solutions is greatly appreciated thanks very much in advance. <?PHP /* Contact Form from HTML Form Guide This program is free software published under the terms of the GNU Lesser General Public License. See this page for more info: http://www.html-form-guide.com/contact-form/contact-form-attachment.html */ require_once("./include/fgcontactform.php"); $formproc = new FGContactForm(); //1. Add your email address here. //You can add more than one receipients. $to = $formproc->AddRecipient('test@alphaboss.ca'); //<<---Put your email address here $subject = 'Form was submitted'; $message = 'New message from a visitor'; $headers = 'From: test@alphaboss.ca' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); // 'test@alphaboss.ca', 'Form was submitted', 'New message from a visitor' //2. For better security. Get a random tring from this link: http://tinyurl.com/randstr // and put it here $formproc->SetFormRandomKey('HG9hPBpn9Bn26yg'); $formproc->AddFileUploadField('photo','jpg,jpeg,gif,png,bmp',2024); if(isset($_POST ['uploads'])) if(isset($_POST ['photo'])) if(count($_POST['uploads']['photo'])) { foreach ($_POST['uploads']['photo'] as $file) { //do your upload stuff here echo $file; } } if(isset($_POST['submitted'])) { if($formproc->ProcessForm()) { $formproc->RedirectToURL("thank-you.php"); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"> <head> <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/> <title>Alpha Boss Computer Services</title> <style> body {font-family: Verdana, sans-serif; margin: 0; height: 1140px; } h1 {text-align:center; color: navy; } #background-image { background-image: url(alpha.png); width: 100%; top: 0; left: 0; height:1140px; opacity: 0.2; position: absolute; background-repeat: repeat; padding: 0; margin: 0; z-index:0; } .navbar { overflow: hidden; background-color: #333; position: fixed; bottom: 0; width: 100%; display: flex; align-items: center; justify-content: center; z-index: 2; } .navbar a { display: inline-block; color: #f2f2f2; text-align: center; padding: 14px 16px; text-decoration: none; font-size: 17px; margin: 0px auto; } .navbar a:hover { background: #f1f1f1; color: black; } .fieldset-auto-width { display: inline-block; } form { position: absolute; z-index: 2; left: 50px; right: 50px; top: 195px; } div.b { line-height: 1.6; } </style> <link rel="STYLESHEET" type="text/css" href="contact.css" /> <script type='text/javascript' src='scripts/gen_validatorv31.js'></script> <script type='text/javascript' src='scripts/fg_captcha_validator.js'></script> <link rel="icon" href="http://localhost/alpha.png" type="image/png" sizes="16x16"> </head> <body> <div id="background-image"></div> <!-- Form Code Start --> <div class="b"><h1>You can call <u>289-696-7530</u> or fill out the contact form below; for your computer, peripheral, and photo slideshow needs. Hours of operation: Monday to Friday 9AM to 5PM.</h1></div> <div class="form"><center><form id='contactus' action='<?php echo $formproc->GetSelfScript(); ?>' method='post' enctype="multipart/form-data" accept-charset='UTF-8'> <fieldset class="fieldset-auto-width"> <legend><h1>Contact Form</h1></legend> <input type='hidden' name='submitted' id='submitted' value='1'/> <input type='hidden' name='<?php echo $formproc->GetFormIDInputName(); ?>' value='<?php echo $formproc->GetFormIDInputValue(); ?>'/> <input type='text' class='spmhidip' name='<?php echo $formproc->GetSpamTrapInputName(); ?>' /> <div class='short_explanation'><font size="3" color="navy"><h1>* required fields</h1></font></div> <div><span class='error'><?php echo $formproc->GetErrorMessage(); ?></span></div> <div class='container'> <label for='name'><font size="3" color="navy"><h1>Your Full Name Below*:</h1></font></label><br/> <input style='width:400px;height:40px;font-size:14pt; border:3px solid black' type='text' name='name' id='name' value='<?php echo $formproc->SafeDisplay('name') ?>' maxlength="50" /><br/> <span id='contactus_name_errorloc' class='error'></span> </div> <div class='container'> <label for='email'><font size="3" color="navy"><h1>Your Email Address Below*:</h1></font></label><br/> <input style='width:400px;height:40px;font-size:14pt; border:3px solid black' type='text' name='email' id='email' value='<?php echo $formproc->SafeDisplay('email') ?>' maxlength="50" /><br/> <span id='contactus_email_errorloc' class='error'></span> </div> <div class='container'> <label for='message'><font size="3" color="navy"><h1>Your Message Below:</h1></font></label><br/> <span id='contactus_message_errorloc' class='error'></span> <textarea rows="10" cols="50" name='message' id='message' style="border:3px solid black"><?php echo $formproc->SafeDisplay('message') ?></textarea> </div> <div class='container'> <label for='photo'><font size="3" color="navy"><h1>Upload your photos:</h1></font></label><br/> <input style='font-size:24px' type="file" name='photo[]' id='photo' multiple=""/><br/> </div> <div class='container'> <input style='font-size:24px' type='submit' name='Submit' value='Submit' /> </div> </fieldset> </form></center></div> <div class="navbar"> <div class="navbar-inner"> <a href="index.html">HOME</a> <a href="https://www.facebook.com/Alpha-Boss-Computer-Services-1259286717548256/">FACEBOOK PAGE</a> </div> </div> <!-- client-side Form Validations: Uses the excellent form validation script from JavaScript-coder.com--> <script type='text/javascript'> // <![CDATA[ var frmvalidator = new Validator("contactus"); frmvalidator.EnableOnPageErrorDisplay(); frmvalidator.EnableMsgsTogether(); frmvalidator.addValidation("name","req","Please provide your name"); frmvalidator.addValidation("email","req","Please provide your email address"); frmvalidator.addValidation("email","email","Please provide a valid email address"); frmvalidator.addValidation("message","maxlen=2048","The message is too long!(more than 2KB!)"); frmvalidator.addValidation("photo","file_extn=jpg;jpeg;gif;png;bmp","Upload images only. Supported file types are: jpg,gif,png,bmp"); // ]]> </script> </body> </html>
  4. Can I send mail locally with either mercury mail which is included with the xampp control panel that I have or hmailserver which I downloaded and maybe see if that would work?
  5. Hello I did everything that you suggested but when I saved the php file and refreshed my web browser I get Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in C:\xampp\htdocs\contact.php on line 20 I added the same email address from $formproc->AddRecipient in the sendmail_from in php.ini I also added a From header with that email address but when I saved the file again and refreshed the page I get Warning: mail(): SMTP server response: 530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [YTOPR0101CA0019.CANPRD01.PROD.OUTLOOK.COM] in C:\xampp\htdocs\contact.php on line 21 here is what I added to both the php.ini file the php file as suggested to the first warning above: From php.ini file: sendmail_from = AlphaBoss17@outlook.com From php file: $to = $formproc->SafeDisplay('email'); $subject = 'Form was submitted'; $message = 'New message from a visitor'; $headers = "From: AlphaBoss17@outlook.com \r\n"; mail($to, $subject, $message, $headers); // 'AlphaBoss17@outlook.com', 'Form was submitted', 'New message from a visitor' I want people to be able to add their full name, email address, and message including uploading photos for submission when they visit the contact page. So I wanted to test it out first before hand. Any ideas as what is happening here? Thanks.
  6. Hello everyone I am trying add the mail() function with the strings from $formproc and $headers but I keep getting this error when I save the php file and refresh page on my web browser it says Parse error: syntax error, unexpected '$formproc' (T_VARIABLE), expecting ',' or ')' in C:\xampp\htdocs\contact.php on line 17 I am not sure what is wrong here any help and solutions is greatly appreciated thanks very much in advance. PS here is the php file below. <?PHP /* Contact Form from HTML Form Guide This program is free software published under the terms of the GNU Lesser General Public License. See this page for more info: http://www.html-form-guide.com/contact-form/contact-form-attachment.html */ require_once("./include/fgcontactform.php"); $formproc = new FGContactForm(); //1. Add your email address here. //You can add more than one receipients. $formproc->AddRecipient('AlphaBoss17@outlook.com'); //<<---Put your email address here $headers = $formproc->SafeDisplay('email'); mail(string $formproc','string $headers); //2. For better security. Get a random tring from this link: http://tinyurl.com/randstr // and put it here $formproc->SetFormRandomKey('HG9hPBpn9Bn26yg'); $formproc->AddFileUploadField('photo','jpg,jpeg,gif,png,bmp',2024); if(isset($_POST['submitted'])) { if($formproc->ProcessForm()) { $formproc->RedirectToURL("thank-you.php"); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"> <head> <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/> <title>Alpha Boss Computer Services</title> <link rel="STYLESHEET" type="text/css" href="contact.css" /> <script type='text/javascript' src='scripts/gen_validatorv31.js'></script> <script type='text/javascript' src='scripts/fg_captcha_validator.js'></script> <link rel="icon" href="http://localhost/alpha.png" type="image/png" sizes="16x16"> </head> <body style="background-color:lightblue;"> <!-- Form Code Start --> <form id='contactus' action='<?php echo $formproc->GetSelfScript(); ?>' method='post' enctype="multipart/form-data" accept-charset='UTF-8'> <fieldset > <legend>Contact us</legend> <input type='hidden' name='submitted' id='submitted' value='1'/> <input type='hidden' name='<?php echo $formproc->GetFormIDInputName(); ?>' value='<?php echo $formproc->GetFormIDInputValue(); ?>'/> <input type='text' class='spmhidip' name='<?php echo $formproc->GetSpamTrapInputName(); ?>' /> <div class='short_explanation'>* required fields</div> <div><span class='error'><?php echo $formproc->GetErrorMessage(); ?></span></div> <div class='container'> <label for='name' >Your Full Name*: </label><br/> <input type='text' name='name' id='name' value='<?php echo $formproc->SafeDisplay('name') ?>' maxlength="50" /><br/> <span id='contactus_name_errorloc' class='error'></span> </div> <div class='container'> <label for='email' >Email Address*:</label><br/> <input type='text' name='email' id='email' value='<?php echo $formproc->SafeDisplay('email') ?>' maxlength="50" /><br/> <span id='contactus_email_errorloc' class='error'></span> </div> <div class='container'> <label for='message' >Message:</label><br/> <span id='contactus_message_errorloc' class='error'></span> <textarea rows="10" cols="50" name='message' id='message'><?php echo $formproc->SafeDisplay('message') ?></textarea> </div> <div class='container'> <label for='photo' >Upload your photo:</label><br/> <input type="file" name='photo' id='photo' /><br/> <span id='contactus_photo_errorloc' class='error'></span> </div> <div class='container'> <input type='submit' name='Submit' value='Submit' /> </div> </fieldset> </form> <!-- client-side Form Validations: Uses the excellent form validation script from JavaScript-coder.com--> <script type='text/javascript'> // <![CDATA[ var frmvalidator = new Validator("contactus"); frmvalidator.EnableOnPageErrorDisplay(); frmvalidator.EnableMsgsTogether(); frmvalidator.addValidation("name","req","Please provide your name"); frmvalidator.addValidation("email","req","Please provide your email address"); frmvalidator.addValidation("email","email","Please provide a valid email address"); frmvalidator.addValidation("message","maxlen=2048","The message is too long!(more than 2KB!)"); frmvalidator.addValidation("photo","file_extn=jpg;jpeg;gif;png;bmp","Upload images only. Supported file types are: jpg,gif,png,bmp"); // ]]> </script> </body> </html>
  7. Ok I got it fixed now i changed th to table in my CSS elements code and it works thanks very much.
  8. I did change both position properties for background and table elements to absolute and set the z-index to number 2 for my table elements I have 2 table headers I want the image to go to the right side table header when I saved the file and refreshed my browser the image was on top of the text instead on the left side of my table here is the code I have for the table elements for CSS and HTML: th { position: absolute; z-index: 2; } <table style="width:100%"> <tr> <th><font size="4" color="navy">Have you just purchased a computer, printer, or WIFI router either individually or in combination of 2 or more items and don't know how or have no time to set it up? Let Alpha Boss do the setup for you in the comfort of your own home or small business, by clicking Contact at the bottom of this page. Providing fast reliable setup (45 minutes or less)of your purchased computer, printer, or WIFI router. Pricing is $50.00 for either individual or combination setup of 2 or more items.</font></th> <th><img src="desktop.jpg" width="650" height="550"></th> </tr> </table> Any solution to this problem would be greatly appreciated, thanks.
  9. Hello everyone I am trying to place an image within the right hand table but the background image is still shown when I place the image in the right hand table of my website that I am working on I would like that part of the background image covered I have attached screenshots of the HTML code and the webpage that I am working on any help and solutions would be greatly appreciated thanks so very much in advance.
×
×
  • Create New...