Jump to content

j4mes_bond25

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Everything posted by j4mes_bond25

  1. My Contact form on my website [url=http://www.allinclusivewebdesign.co.uk]www.allinclusivewebdesign.co.uk[/url] does the job well. However, as the time went by, I've been thinking to make it do MORE than just a basic form, allowing me to receive the information viewers' submits (as it does perfectly well, at the moment). I wonder if anyone could point me in the right direction, as how could I possibly send a "Bcc" to the viewer who fill the form in with message saying: [CODE]Thanks for contacting us. We'll be in touch soon (if you've asked to be contacted). Following are the details you've sent: (these details would be be exactly same as I receive i.e. all the details from the field). Please visit us soon for your bespoke web solution. Regards, www.allinclusivewebdesign.co.uk[/CODE] Now, I reckon the above message could be saved in one new variable, so I could do my editing in the message along with some formatting, etc. & THEN recall this "email confirmation" variable at some point, if such a thing is attainable. My present PHP code is: [code=php:0]<?php // If the form has been posted, analyse it: if ($_POST) { // CURLY BRACKET (Open): After Clicking Submit foreach ($_POST as $field => $value) { $value = trim($value);   } // Creating Variables $to="contact@allinclusivewebdesign.byethost13.com"; $inquiry=$_POST['inquiry']; $title=$_POST['title']; $first_name=$_POST['first_name']; $last_name=$_POST['last_name']; $email=$_POST['email']; $phone=$_POST['phone']; $message=stripslashes($_POST['message']); $reply=$_POST['reply']; $contact=$_POST['contact']; $headers="From: " . $_POST['email'] . "\r\n" . "Inquiry: " . $_POST['inquiry'] . "\r\n" . "Title: " . $_POST['title'] . "\r\n" .  "First Name: " . $_POST['first_name'] . "\r\n" . "Last Name: " . $_POST['last_name'] . "\r\n" . "E-mail: " . $_POST['email'] . "\r\n" . "Phone: " . $_POST['phone'] . "\r\n" . "Reply: " . $_POST['reply'] . "\r\n" . "Contact: " . $_POST['contact']; // Create empty ERROR variables $error = ""; // for fields left BLANK $errorflag = ""; // for fields with INVALID data entered // Check for field/fields that is/are left BLANK if (($first_name == "") || ($last_name == "") || ($email == "") || ($phone == "") || ($message == "")) { // CURLY BRACKET (Open): For Validating if fields are left blank $error = "<span class='colorTextBlue'>Please fill in all fields!</span>"; } // CURLY BRACKET (Close): For Validating if fields are left blank else { // CURLY BRACKET (Open): Form Validation // Validate First Name (including ERRORS such as (1) field left BLANK (2) field with INVALID data entered if (ctype_alpha($first_name) == FALSE)  { $error = "<span class='colorTextBlue'>Please enter a valid First Name <span class='italic'>(Alphabets only)</span></span>"; $errorflag= "first_name"; } // Validate Last Name (including ERRORS such as (1) field left BLANK (2) field with INVALID data entered else if (ctype_alpha($last_name) == FALSE) { $error = "<span class='colorTextBlue'>Please enter a valid Last Name <span class='italic'>(Alphabets only)</span></span>"; $errorflag="last_name"; } // Validate E-mail (including ERRORS such as (1) field left BLANK (2) field with INVALID data entered else if ((strpos($email, "@") == FALSE)|| (strpos($email, ".") == FALSE) || (strpos($email, " ") != FALSE)) { $error = "<span class='colorTextBlue'>Please enter a valid E-mail</span>"; $errorflag="email"; } // Validate Contact No. (including ERRORS such as (1) field left BLANK (2) field with INVALID data entered else if (is_numeric($phone) == FALSE) { $error = "<span class='colorTextBlue'>Please enter a valid Contact No. <span class='italic'>(must contain numbers only, without any space)</span></span>"; $errorflag="phone"; } } // CURLY BRACKET (Close): Form Validation // Confirmation Message seen AFTER filling the form and pressing "Submit" button (whether there's an error or not) // If there's an error along with displaying the list of flagged error/errors if ($error != "") { // CURLY BRACKET (Open): For Error echo "<br/>&nbsp;&nbsp;&nbsp;<b><span class='colorTextRed'>Error Occured: </b>" . $error."</span>" ; } // CURLY BRACKET (Close): For Error // If there's NO error at all, along with displaying the filled fields else if (mail($to, $_POST['inquiry'], $message, $headers)) { echo "<p><span class='colorTextBlue'>E-mail sent successfully</span></p>"; echo "<p>Thanks for your comment and time. We will be in touch with you shortly, if required. Following are the details you filled in.<br/><br/>"; echo "<b>Nature of Inquiry:</b> ". $inquiry . "<br/>"; echo "<b>Title:</b> ". $title . "<br/>"; echo "<b>First Name:</b> ". $first_name . "<br/>"; echo "<b>Last Name:</b> ". $last_name . "<br/>"; echo "<b>E-mail:</b> ". $email . "<br/>"; echo "<b>Contact No.:</b> ". $phone . "<br/>"; echo "<b>Message:</b> ". $message . "<br/>"; echo "<b>Reply:</b> ". $reply . "<br/>"; echo "<b>Contact Method:</b> ". $contact . "<br/></p>"; } else { $error = "<span class='colorTextRed'>&nbsp;&nbsp;&nbsp;E-mail NOT sent</span>"; } } // CURLY BRACKET (Close): After Clicking Submit // Displays the Empty variables i.e. when the Contact Form appears completely blank for the VERY FIRST time with all blank fields else { $inquiry = ""; $title = ""; $first_name = ""; $last_name = ""; $email = ""; $phone = ""; $message = ""; $reply = ""; $contact = ""; $errorflag = ""; } ?> [/code] What I've done, additionally, with the hope of sending copy to viewers is: >> created a new variable "bcc" $bcc=$_POST['email']; AND added "$bcc" in my mail function by: (mail($to, $_POST['inquiry'], $message, $headers, $bcc)) This DID NOT work, when I tested the form. Anyhow, would I need a "bcc" OR "cc" in this case. I reckon, it should be "bcc" since I don't want viewers to know that I'm receiving my mails on "contact@allinclusivewebdesign.byethost13.com"
  2. After virtually, bending over backwards, I managed to FINALLY got the SMTP e-mail making it possible to actually receive the data entered by viewers in my Contact form. Its code (in .txt) can be seen from: http://members.lycos.co.uk/darsh25/AllInclusiveWebDesign/contact.php.txt Actual page can be viewed on: http://members.lycos.co.uk/darsh25/AllInclusiveWebDesign/contact.php Sadly, however, I was only receiving the "message" itself & NOT the "title", "first_name", "last_name", "contact_no.", etc. I realised that I didn't include other field WITHIN php's "mail" function & hence wasn't gettting this on my e-mail (after user submits the form). I've now added "additional parameters" (if I'm right), so as to receive all the required fields. Firstly, I'm unsure if what I've added is right or wrong & secondly, I'm getting some "syntax" error. So, the 1st version of this PHP "mail" code was: [code=php:0](mail("contact@allinclusivewebdesign.byethost13.com", $_POST['inquiry'], stripslashes($_POST['message']), "From: " . $_POST['email']))[/code] The revised version i.e. the one where I've added "additional parameters", so as to receive ALL fields in my e-mail: [code=php:0](mail("contact@allinclusivewebdesign.byethost13.com", $_POST['inquiry'], stripslashes($_POST['message']), ("From: " . $_POST['email']), ("Inquiry: " . $_POST['inquiry']), ("Title: " . $_POST['title']), ("First Name: " . $_POST['first_name']), ("Last Name: " . $_POST['last_name']), ("E-mail: " . $_POST['email']), ("Phone: " . $_POST['phone']), ("Message: " . $_POST['message']), ("Reply: " . $_POST['reply']), ("Contact: " . $_POST['contact'])) [/code] I wonder, hence, if anyone around could possily check my "updated" code, which is: http://members.lycos.co.uk/darsh25/AllInclusiveWebDesign/contact_updated.php.txt I simply wish to receive ALL the fields data on my e-mail.
  3. I normally use [url=http://validator.w3.org/]http://validator.w3.org/[/url] to validation my XHTML, however, in my current project, I've used PHP as well & all my files has ".php" extention so can't use this site to validation my XHTML codes. Mainly the PHP I've used is for the "include" function to share navigation, header, footer, etc. across all the pages. How do I go about validating these pages (having extention ".php" but has "xhtml" codes within). One of the example is of Privacy page i.e. "Privacy.php": [code=php:0]<div id="header"> <?php include("inc/header.inc");?> </div> <?php include("inc/head.inc");?> <body> <?php include("inc/banner_topmenu.inc");?> <?php include("inc/left_right_content.inc");?> <div id="centerContent"> <p class="first-letter"> This privacy statement discloses the privacy policies of All Inclusive Web Design. It applies solely to this website itself along with its content <span class="italic">(text and images)</span>. All Inclusive Web Design is committed to respecting your privacy. We have structured our website so that, you can visit it without identifying yourself or revealing any personal information.</p> <p>Under the Data Protection Act 1998, we have a legal duty to protect any personal information we collect from you. We do not pass on your details to any third party. Your visit to All Inclusive Web Design is anonymous and hence no personal information is recorded or gathered, unless when you fill in the contact form to contact us.</p> <p>If you do not wish to be contacted using any of the details you provide us through the Contact form, please say so when sending the form.</p> </div> <?php include("inc/footer.inc");?> </body> </html>[/code]
  4. I'm on the edge of finishing my website, which has a "Contact" form, allowing people to fill in their question & once they press the "Submit", after the data gets validated (using all the validation I've in it for each individual fields like Name, E-mail, Telephone, etc.), it should reach my e-mail. It can be seen on: http://darsh25.silverserve.co.uk/AllInclusiveWebDesign/contact.php I'm using PHP's mail function to receive this form & its code is: (mail("contact@allinclusivewebdesign.co.uk", $_POST['inquiry'], stripslashes($_POST['message']), "From: " . $_POST['email'])) As far as I know, we HAVE TO HAVE "SMTP based e-mail" rather than merely using "yahoo" or "hotmail" e-mail. Right now, I'm interested in having a FREE php hosting, since it's only a start so paying to have "smtp" based e-mail makes less sense (which I believe I almost always get when I pay towards a Web Hosting). Now, some website offering "php web hosting" for free such as companies like: http://www.0php.com/free_PHP_hosting.php says they offer POP3 e-mail as a part of their package, so is this what I need OR should I be looking for something that specifically says "SMTP" or something ??? I'm bit at sea as what EXACTLY do I need in order to be able to receive the "submitted form" on some e-mail. Can anyone point me in the right direction OR any website that offers free php hosting having feature that allows me to RECEIVE this submitted form on some e-mail ???
  5. I've a contact form, on my nearly finished website, allowing viewers to send the data, which I've validated with different validation rule depending on the data required for a field itself. Website itself can be seen on: http://members.lycos.co.uk/darsh25/AllInclusiveWebDesign/contact.php Problem is with last 2 fields i.e. "Reply Required" AND "How would you like to be contacted?" If user press the submit button, I want the "filled" fields remain same, hence, making them NOT to re-type what they's already done. I wish to do the same for these 2 options as well, hence whichever radio button they'd chosen, after pressing submit, if they mis-filled any fields (for example, "e-mail"), then I want the option chosen in 2 radio buttons staying same i.e. whatever they'd chosen Problem is, after pressing "Submit" the radio button options for these 2, ALWAYS goes to the "second option" regardless of the option chosen ??? This makes them RE-chose the radio button option. Related code [code=php:0]<tr id="contactTable"> <td id="contactTable">Reply Required:</td> <td id="contactTable"><input type="radio" name="reply" value="Yes" checked="checked"/>Yes <input type="radio" name="reply" value="No" <?php if ($reply="No") echo "checked='checked'"; ?>/>No</td> </tr> <tr id="contactTable"> <td id="contactTable">How would you like to be contacted <span class="italic">(if required)</span>?<br/><br/></td> <td id="contactTable"><input type="radio" name="contact" value="Email" checked="checked"/>E-mail <input type="radio" name="contact" value="Telephone" <?php if ($contact="Telephone") echo "checked='checked'"; ?>/>Telephone </td> </tr> [/code] Wonder why's this happening ??? Can anyone help ???
  6. I've been trying to display a simple & short message in viewer's own language for which I'm using the following script, right at the top of their screen i.e. just above the banner (in my website on: members.lycos.co.uk/darsh25/ .................. select "contact.php" Although, in my browser, this script identifies that my browser being set to "English" & hence displays "Hello", as it can be seen from: [code=php:0]<?php function lixlpixel_get_env_var($Var) { if(empty($GLOBALS[$Var])) { $GLOBALS[$Var]=(!empty($GLOBALS['_SERVER'][$Var]))? $GLOBALS['_SERVER'][$Var] : (!empty($GLOBALS['HTTP_SERVER_VARS'][$Var])) ? $GLOBALS['HTTP_SERVER_VARS'][$Var]:''; } } function lixlpixel_detect_lang() { // Detect HTTP_ACCEPT_LANGUAGE & HTTP_USER_AGENT. lixlpixel_get_env_var('HTTP_ACCEPT_LANGUAGE'); lixlpixel_get_env_var('HTTP_USER_AGENT'); $_AL=strtolower($GLOBALS['HTTP_ACCEPT_LANGUAGE']); $_UA=strtolower($GLOBALS['HTTP_USER_AGENT']); // Try to detect Primary language if several languages are accepted. foreach($GLOBALS['_LANG'] as $K) { if(strpos($_AL, $K)===0) return $K; } // Try to detect any language if not yet detected. foreach($GLOBALS['_LANG'] as $K) { if(strpos($_AL, $K)!==false) return $K; } foreach($GLOBALS['_LANG'] as $K) { if(preg_match("/[\[\( ]{$K}[;,_\-\)]/",$_UA)) return $K; } // Return default language if language is not yet detected. return $GLOBALS['_DLANG']; } // Define default language. $GLOBALS['_DLANG']='en'; // Define all available languages. // WARNING: uncomment all available languages $GLOBALS['_LANG'] = array( 'af', // afrikaans. 'ar', // arabic. 'bg', // bulgarian. 'ca', // catalan. 'cs', // czech. 'da', // danish. 'de', // german. 'el', // greek. 'en', // english. 'es', // spanish. 'et', // estonian. 'fi', // finnish. 'fr', // french. 'gl', // galician. 'he', // hebrew. 'hi', // hindi. 'hr', // croatian. 'hu', // hungarian. 'id', // indonesian. 'it', // italian. 'ja', // japanese. 'ko', // korean. 'ka', // georgian. 'lt', // lithuanian. 'lv', // latvian. 'ms', // malay. 'nl', // dutch. 'no', // norwegian. 'pl', // polish. 'pt', // portuguese. 'ro', // romanian. 'ru', // russian. 'sk', // slovak. 'sl', // slovenian. 'sq', // albanian. 'sr', // serbian. 'sv', // swedish. 'th', // thai. 'tr', // turkish. 'uk', // ukrainian. 'zh' // chinese. ); // Redirect to the correct location. //header('location: [a href=\"http://www.your_site.com/index_'.lixlpixel_detect_lang().'.php');\" target=\"_blank\"]http://www.your_site.com/index_'.lixlp...#39;.php');[/a] // Example Implementation if ($GLOBALS['_LANG'] = 'en') { echo '<span class="colorTextRed">"Hello"'; } else if ($GLOBALS['_LANG'] = 'fr') { echo '<span class="colorTextRed">"Bonjour"'; } else { echo '<span class="colorTextRed">"Hello"'; } //echo '<span class="colorTextRed">The Language detected is: '.lixlpixel_detect_lang(); // For Demonstration ?> [/code] I managed to get this script from somewhere over the Internet, however, I added "if.....else" right at the end, since I want this script identify the browser language (or something like that) & then based on the language identified, I wish to simply display the equivalent of "Hello" in user's own language. I tried changing my browser's language to French, in order to TEST this script as if it displays "Bonjour" but that didn't work. Could anyone around help me ???
  7. One of the page from my presently under-contruction website can be seen on [a href=\"http://members.lycos.co.uk/darsh25/Personal%20Website/services.php\" target=\"_blank\"]http://members.lycos.co.uk/darsh25/Persona...te/services.php[/a] As it can be seen from the HEADER (right at the top) that I've the text-size selector (which isn't working, at the moment) along with the present date (as set in user's own computer). Realising that such a "text-sizer" isn't quite a good idea since browser provides that facility anyway, I'm thinking to get rid-off this text-sizer and leave the "date" code as it is. However, in the same HEADER area, I wonder if there's ANYTHING in PHP that allows to do the following: >> Firstly, identify the "clock/time setting" in their computer and then display message saying "Good Morning/Afternoon/Evening". >> Additionally, I would like this "Good Morning/Afternoon/Evening" appearing in viewers OWN language i.e. if he's from English speaking country then this message should appear in ENGLISH, if he's from French speaking country this message should appear in FRENCH, etc. I've read a book few months back on PHP which said such a thing could be possible using a PHP script that identifies the "clock timing" along with the "language" set on viewers browser (or something like that). I really DO NOT want to ask user about their language/country (and then display the message in THEIR language) since not all viewers would appreciate answering such question and beside the services of my website in itself isn't quite relevant to asking such question. Hence, would there be anything within PHP script that identifies the relevant information (time & language/country) and then display the necessary "Welcome Message" such as: > Good Morning, Hope you enjoy your stay (if user's location or brower setting is ENGLISH) > Guten Morning, (same message in German) (if user's location or brower setting is GERMAN). > Bonjour, (same message in French) (if user's location or brower setting is FRANCE/French speaking location). Any idea, alternative thing to do instead, recommendation, help or guidance would be greatly appreciated.
  8. After formatting my laptop's harddrive, I have to reinstall PHP setup. Earlier a friend of mine did it, which was working perfectly well. But now, I've used the software "XAMPP" which contains PHP, MySQL along with Apache server. However, this time I used XAMPP & in it's control window, Apache, MySQL and FireZilla are all running & hence I believe the installation went successful. I now want to open my PHP files. The program's instruction say that All the documents should be saved in folder ".\xampp\htdocs" [a href=\"http://www.apachefriends.org/en/xampp-windows.html#1168\" target=\"_blank\"]http://www.apachefriends.org/en/xampp-windows.html#1168[/a] I saved my website's folder i.e. "Personal Website" folder in the location c:/program files/xampp/htdocs" Problem is everytime, I try to open the document in the browser, I get the message window asking "What should Firefox do with this file? with couple of option saying "Open with: phpfile (default) or Save to disc" & when I say OK for "open with "phpfile (default)" it opens its "coding" in my Dreamweaver instead of its "result" in the web browser. Could anyone possibly point me in the right direction as how do I go about opening my PHP pages as I was able to earlier.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.