Jump to content

Search the Community

Showing results for tags 'forms'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

  1. Hello. I have a table in W3CSS. Ive got 4-5 lines / sections, and in each section I have one line of SELECT fields (along with other information). i am wondering I have 4-5 SELECT fields in a table line/row, and one TEXT field. Is there a way that if a person a) keeps all values blank (nothing selected) - no messages come up. b) when they select one value in that row, or adds a number in the text field (I guess i'll use classes), a script checks all values in that row & gives a warning if any value is blank.
  2. Hello. I have a bit of a problem with W3CSS and INPUTS (textarea) https://www.w3schools.com/w3css/w3css_input.asp Textarea is not referenced with the above page. Here is my HTACCESS :- RewriteRule ^([0-9]+)?$ /PATHNAME/yours_description.php?entity=$1 [nc,l,QSA] if i go in the URL - path/67 my script activates and the vaklue of $entity is retrieved. HOWEVER - PROBLEM. I want a TEXTAREA to be sent as a POST value. But no matter what I do in w3css, the textarea comes out as blank. (my php script also has print_r for $_GET and $_POST - the $description value isnt passed at all.) Here is my template <form class="w3-container w3-light-grey" action="/yours/description/{$entity}" type="POST"> <label>Your Business description</label> <textarea class="w3-input w3-border-0" name="description" rows="6" cols="45" value="{$description}"></textarea> <button class="w3-btn w3-brown">Update</button></p> </form> Is it possible to use a combination of GET and POST ? I'll rather use GET so a person can easily switch entities. But the rest of the form elements need to be in POST.
  3. Greetings: I've recently taken over responsibility for managing the following website: Abacus Custom Painting. The prior webmaster is unavailable for consul. There are three site webpages on which three (in question) submission forms are embedded:Those pages are:1) Home Page: Note the "No Job Too Small... Get Your Free Estimate Today!" submission form. Visitors are encouraged to submit first name, last name, email address & phone number, and a brief description of needed work vis-a-vis this form. 2) 7 Things You Must Know Before Hiring a Painter Page: Note the "Get Your Free Estimate Today!" submission form. Visitors are encouraged to submit first name, last name, email address & phone number, zip-code, and a brief description of needed work vis-a-vis this form. 3) 5 Suggestions To Choose Paint Colors Page: Note the "Get Your Free Estimate Today!" submission form (same as above.)For the first two (2) site-pages and submission forms, could someone identify the code (in its entirety) which governs these two unique submission forms? My goal with posting this thread is to:1) better understand what specific script(s), even if remotely-hosted, is being invoked when a site visitor chooses to submit contact details through one or all of the above submission forms &2) understand exactly (step by step) which process or code edits/modifications are needed to ensure visitor-provided contact details are submitted/routed to an email address or other technology of my choosing.Thanks in advance --
  4. Hello! What is needed to make this form work? The answer may be obvious to most, but I have limited knowledge of html, css, and trying to understand php through the tutorials. I have tried searching similar questions but haven't been able to apply answers to my form. I have modified the form taken from the Parallax template and created a php page, but when I hit the SEND MESSAGE it goes to a 404 error page. I have the website up on a test site, http://debschneiderdesign.com/NextChapter/home.html#home Thanks, Deb <form action="/NextChapter/form-to-email.php" method="post" target="blank" > <div class="w3-row-padding" style="margin:0 -16px 8px -16px"> <div class="w3-half"> <input class="w3-input w3-border" type="text" placeholder="Name" required name="Name"> </div> <div class="w3-half"> <input class="w3-input w3-border" type="text" placeholder="Email" required name="Email"> </div> </div> <input class="w3-input w3-border" type="text" placeholder="Message" required name="Message"> <button class="w3-button w3-dark-grey w3-right w3-section" type="submit"> <i class="fa fa-paper-plane"></i> SEND MESSAGE</a> </button> </form>
  5. Hi, I am attempting to create a form control with an input field in the centre, and plus/minus buttons either side. The buttons have an absolute position set so they remain at either edge of the parent container, with the input (ideally) adjusting in with to make up the remaining width. Only in practice it doesn't. I can't really set a width to the input as it needs to adjust the width to for different screen widths. The code: .responsive-container{position: relative; width: 100%;} .minus-button{position: absolute; left: 0; width: 40px;} input{position: absolute; left: 40px; right: 40px; width: auto;} .plus-button{position: absolute; right: 0; width: 40px;} <div class="responsive-container"> <a class="minus-button">-</a> <input> <a class="plus-button">+</a> </div> Hopefully you can see what I am trying to achieve here. If I set the input to 100% width, it goes beyond the container because it has been budged by 40px. Setting it's width to auto doesn't seem to fill the space correctly. Any pointers here appreciated!
  6. When you add a form that is modal and view on a mobile device (apple mostly) the background still scrolls with your finger. This creates a problem as the form fields (Inputs) do not line up and it almost impossible to edit or add text to input fields as you cannot select them. To reproduce just run the modal login example on your mobile phone and move your finger then try to add text to the input fields - !
  7. Hi there, I am trying to only allow a 'next' button to show if a form element is selected. For some reason I am only succeeding to hide the button, and not reveal when the radio button is selected. I am sure it should be relatively simple... The code: .ampwizard .button {opacity: 0;} input[type="radio"]:checked .ampwizard .button{opacity: 1;} <div class="ampwizard"><input type="submit" class="button" name="install-next" value="Next" /></div> Help appreciated with thanks!
  8. Hi, it's been awhile since I've posted here. Maybe that's a good thing in that I guess I'm doing things right? :-) Anyway, something that I find confusing is the "process input" when it comes to forms. An example would be a subscription form. Many, many designs out there on the web but few of their authors explain simply how to get the form to work. And by work I mean how to direct the form info to a particular email. In this case it would obviously be an email of mine where I could receive the subscriber's email address. Here is the html code section for a subscription form: <body> <section class="subscribe"> <div class="subscribe-pitch"> <h3>Subscribe</h3> <p>Subscribe to our newsletter to get the latest scoop right to your inbox.<p> </div> <form action="index.html" method="post" class="subscribe-form"> <input type="email" name="email" class="subscribe-input" placeholder="Email address" autofocus> <button type="submit" class="subscribe-submit">Subscribe</button> </form> </section> </body> It looks really good, I've customized it, etc. Now all I need to know is where to place the email where the info is sent. I think it might be a separate PHP page on the server but not sure. I hope someone here has a simple solution. For those wanting more specifics, here is the page from where I got the code. You'll notice in the comments section others asking this same question yet the author doesn't answer. Thank You for any help. Daniel
  9. Hy, I'am fresh in web Developement and I'am wondering why sending data via forms opens the php-file automaticly instead of working with the data in the backround. <table class="table table-bordered"> <form action="php/interface.php" method="post"> <thead> <tr> <th><input type="submit" ></th> <th><p>Serie: <input type="text" name="serie" /></p></th> <th><p>Korn: <input type="text" name="korn" /></p></th> </tr> </thead> </form> </table> On the php-site I then want to take the user input, built a query -> save the result in a php-var - konvert it to Json and then do something in Javascript to display the result in the Frontend. The Query and the conversion etc. works, but my Problem is, that pressing the submit button opens the php-file.
  10. Hello everyone, I am trying to make my first website and have been going through some javascript examples on W3S to learn how to make a website more interactive. I have been looking at the code for modal login and signup forms found here: https://www.w3schools.com/howto/howto_css_login_form.asp and here: https://www.w3schools.com/howto/howto_css_signup_form.asp The HTML and CSS are easy enough to understand I think, but I seem to be having some trouble with the JS aspect of the tutorials. What I have done is simply add both forms to an HTML document, linked to the styling and that seems to be working fine. The problem is when I click outside of the form the display for the modal forms should be set to none by the javascript code but this only works for one button. I have been able to rearrange some of the code so the second button works but then the first button wouldn't work. I have the code listed below. I've been trying this for a few days and would really like some help. Thanks in advance. HTML: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Website3</title> <link rel="stylesheet" href="reset.css"> <link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="login.css"> </head> <body> <div id="outerMain"> <div id="main"> <header> <button onclick="document.getElementById('id01').style.display='block'" style="width:auto;">Login</button> <button onclick="document.getElementById('id02').style.display='block'" style="width:auto;">Sign Up</button> <div id="id01" class="modal"> <form class="modal-content animate" action="/action_page.php"> <div class="imgcontainer"> <span onclick="document.getElementById('id01').style.display='none'" class="close" title="Close Modal">&times;</span> <img src="logo.png" alt="Avatar" class="avatar"> </div> <div class="container"> <label><b>Username</b></label> <input type="text" placeholder="Enter Username" name="uname" required> <label><b>Password</b></label> <input type="password" placeholder="Enter Password" name="psw" required> <button type="submit">Login</button> <input type="checkbox" checked="checked"> Remember me </div> <div class="container" style="background-color:#f1f1f1"> <button type="button" onclick="document.getElementById('id01').style.display='none'" class="cancelbtn">Cancel</button> <span class="psw">Forgot <a href="#">password?</a></span> </div> </form> </div> <div id="id02" class="modal"> <form class="modal-content animate" action="/action_page.php"> <div class="imgcontainer"> <span onclick="document.getElementById('id02').style.display='none'" class="close" title="Close Modal">&times;</span> </div> <div class="container"> <label><b>Email</b></label> <input type="text" placeholder="Enter Email" name="email" required> <label><b>Password</b></label> <input type="password" placeholder="Enter Password" name="psw" required> <label><b>Repeat Password</b></label> <input type="password" placeholder="Repeat Password" name="psw-repeat" required> <input type="checkbox" checked="checked"> Remember me <p>By creating an account you agree to our <a href="#">Terms & Privacy</a>.</p> <div class="clearfix"> <button type="button" onclick="document.getElementById('id02').style.display='none'" class="cancelbtn">Cancel</button> <button type="submit" class="signupbtn">Sign Up</button> </div> </div> </form> </div> <script src="scripts.js"> </script> </header> <section> <center><img src="centerimg.png" alt=""></center> </section> </div> </div> <footer> <center>HERE IS THE FOOTER!!</center> </footer> </body> </html> Javascript: var login = document.getElementById('id01'); var modal = document.getElementById('id02'); console.log(login); console.log(modal); if(login == document.getElementById('id01')){ console.log(login); window.onclick = function(event) { if (event.target == login) { login.style.display = "none"; } }; } window.onclick = function(event) { if (event.target == modal) { modal.style.display = "none"; } }; CSS: html,body{ height: 100%; } #outerMain { min-height: 100%; } #main{ overflow: auto; padding-bottom: 100px; background-color: green; } header{ background-color: blue; } /* Full-width input fields */ input[type=text], input[type=password] { width: 100%; padding: 12px 20px; margin: 8px 0; display: inline-block; border: 1px solid #ccc; box-sizing: border-box; } /* Set a style for all buttons */ button { background-color: #4CAF50; color: white; padding: 14px 20px; margin: 8px 0; border: none; cursor: pointer; width: 100%; } button:hover { opacity: 0.8; } /* Extra styles for the cancel button */ .cancelbtn { width: auto; padding: 10px 18px; background-color: #f44336; } /* Center the image and position the close button */ .imgcontainer { text-align: center; margin: 24px 0 12px 0; position: relative; } img.avatar { width: 40%; border-radius: 50%; } .container { padding: 16px; } span.psw { float: right; padding-top: 16px; } /* The Modal (background) */ .modal { display: none; /* Hidden by default */ position: fixed; /* Stay in place */ z-index: 1; /* Sit on top */ left: 0; top: 0; width: 100%; /* Full width */ height: 100%; /* Full height */ overflow: auto; /* Enable scroll if needed */ background-color: rgb(0,0,0); /* Fallback color */ background-color: rgba(0,0,0,0.4); /* Black w/ opacity */ padding-top: 60px; } /* Modal Content/Box */ .modal-content { background-color: #fefefe; margin: 5% auto 15% auto; /* 5% from the top, 15% from the bottom and centered */ border: 1px solid #888; width: 80%; /* Could be more or less, depending on screen size */ } /* The Close Button (x) */ .close { position: absolute; right: 25px; top: 0; color: #000; font-size: 35px; font-weight: bold; } .close:hover, .close:focus { color: red; cursor: pointer; } /* Add Zoom Animation */ .animate { -webkit-animation: animatezoom 0.6s; animation: animatezoom 0.6s } @-webkit-keyframes animatezoom { from {-webkit-transform: scale(0)} to {-webkit-transform: scale(1)} } @keyframes animatezoom { from {transform: scale(0)} to {transform: scale(1)} } /* Change styles for span and cancel button on extra small screens */ @media screen and (max-width: 300px) { span.psw { display: block; float: none; } .cancelbtn { width: 100%; } }
  11. QUESTION ONE: When using the form attribute with a non-form element to redirect the contents of the non-form element to the form element, will confusion be created, if the non-form element is included in a form element different from the form element that contains the type='submit' input element? QUESTION TWO: Are fieldset elements an exception in this regard? Or, are they, too, treated as non-form elements.
  12. After letting a project age well, I'm looking at modernizing my code. The project takes the data input all year long at several different events and builds a 'league scoreboard' of them. The code goes back as far as 2002 in the oldest parts and the last major update to the code was in '07 even if CSS was added by someone else in '14. I have not worked with CSS before, and had a helper apply it to the PHP pages I coded way back when, but they were using a HTML4 subset that I would consider 'less than easily human readable'. My helper dropped out and I found myself looking at W3.css to learn what about what had changed in the ten years or so since I worked actively on this codebase, in order to pick up what they had started and migrate to something that I could maintain alongside my code. It was also decided to try and code parts of the project specifically for mobile use first. (/backstory) After playing around with W3.css I came up with a HTML template of what I'd like to get working. http://scaikeqc.org/sandbox/tf-03.html. It needs polishing, and some refinements, but its close to what I want for the mobile experience. Please note, there are no FORM tags in that page so the selects and inputs are for show only. I tried making a proper form of it, http://scaikeqc.org/sandbox/tf-03.php and it was a right mess. Every time you click on the accordion labels to expand them, the form submits, the script reloads, hilarity ensues. This introduces trash into the resultset and before I remembered to use the action tag on the form element, I crashed the GET. Is it possible to have a whole-page form broken into accordion segments? Here is a snip of the-03.php <form class="w3-form" method="post" action="<?php echo $_SERVER[PHP_SELF]?>"> <div class="w3-accordion w3-light-grey"> <button onclick="feif('Rider')" class="w3-btn-block w3-centered"> Open Rider Selection </button> <div id="Rider" class="w3-accordion-content w3-container w3-red"> <H2>Select the Rider</H2> <SELECT class="w3-select" NAME="Pname"> <?PHP IF (isset($Pname)){ printf("<OPTION VALUE=\"%s\">RiderID: %s\n", $Pname, $Pname); } else { echo "<OPTION VALUE=\"XXX\">Select Rider<OPTION VALUE=\"XXX\">-----\n"; echo "<OPTION VALUE=\"NEW\">**NEW RIDER**\n"; } ?> <OPTION VALUE="XXX">----- <OPTION VALUE="306">Johanna <OPTION VALUE="83">Aaron MacGregor <!-- 465 additional select items omitted for brevity--> <OPTION VALUE="421">Zinaida Orshima <OPTION VALUE="114">Zuriel Nightshade <OPTION VALUE="XXX">-----<OPTION VALUE="NEW">**NEW RIDER** </SELECT> </div> <button onclick="feif('Horse')" class="w3-btn-block w3-centered"> Open Horse Selection </button> <div id="Horse" class="w3-accordion-content w3-container w3-red"> <H2>Select the Horse</H2> <SELECT class="w3-select" NAME="Hname"> <?PHP IF (isset($Hname)){ printf("<OPTION VALUE=\"%s\">HorseID:%s\n", $Hname, $Hname); } else { echo "<OPTION VALUE=\"XXX\">Select Horse<OPTION VALUE=\"XXX\">-----\n"; echo "<OPTION VALUE=\"NEW\">**NEW Horse**\n"; } ?> <OPTION VALUE="12">Unknown Mount <OPTION VALUE="XXX">----- <OPTION VALUE="103">Ace <!-- 380 additional select items omitted for brevity--> <OPTION VALUE="236">Zeus' Dream <OPTION VALUE="280">Zia <OPTION VALUE="XXX">-----<OPTION VALUE="NEW">**NEW HORSE** </SELECT> </div> The form continues through five more containers I've not copied here. <input type="submit"> </FORM> <script> function feif(id) { var x = document.getElementById(id); if (x.className.indexOf("w3-show") == -1) { x.className += " w3-show"; } else { x.className = x.className.replace(" w3-show", ""); } } </script> I have a proof-of-concept form that does work(no accordions or data validation, data entered is not retained). This one checks an events database to see which of the five games are being played and only displays the data entry containers for the games that are being run. This is why I wanted to containerize the different sections of data entry. You can poke at that form here http://scaikeqc.org/sandbox/tf-05.php. If you've gotten this far in my post, please accept my thanks for seeing it through, and my apologies for less than beautified code. I'm recycling a lot of the form code from the previous version and haven't had the time to polish non-working code.
  13. Hello. I've created a small form with 6 text boxes and 2 select boxes/fields. The problem I'm facing is that I'm unable to post from the form to another php file. In the html form, I've written:- <form action="newmember.php" method="POST"> <table> <tr> <td>Full Name / Business Name:</td> <td><input name="txtAccountName" size="20" maxlength="50"></td> <td></td> </tr> <tr> <td>Username:</td> <td><input name="txtUsername" size="20" maxlength="50"></td> <td></td> </tr> <tr> <td>EMail:</td> <td><input name="txtEmail" size="20" maxlength="100"></td> <td></td> </tr> <tr> <td>Password:</td> <td><input name="txtPassword" type="password" size="20" maxlength="20"></td> <td></td> </tr> <tr> <td>Confirm Password:</td> <td><input name="txtConfirm_Password" type="password" size="20"></td> <td></td> </tr> <tr> <td>DOB:</td> <td><input name="txtdob" size="12" value="dd/mm/yyyy" maxlength="12"></td> <td></td> </tr> <tr> <td>Membership Type:</td> <td><select name="comMembership" size="1"> <option selected="selected">Individual</option> <option>Business</option> </select> </td> <td></td> </tr> <tr><td></td></tr> <tr> <td>You Agree to our<br> Terms and Conditions,<br> and Privacy/Cookies Notice.</td> <td><select name="txtAgree" size="1"> <option selected="selected">N</option> <option>Y</option> </select> </td> </tr> </table> <input name="submit" type="image" src="/mainimages/submit.jpg" style="border: 0" alt=""> </form> And in the newmember.php file I've so far written:- <?php // Check Entries $New_Agree = $_POST["txtAgree"]; $New_Fullname = $_POST["txtAccountName"]; $New_Username = $_POST["txtUsername"]; $New_EMail = $_POST["txtEmail"]; $New_Password = $_POST["txtPassword"]; $New_Confirm_Password = $_POST["txtConfirm_Password"]; $New_Dob = $_POST["txtdob"]; $New_Membership = $_POST["comMembership"]; ?> I'd just like to ask:- 1. Dose my coding look correct, as I've not been faced with posting problem before? 2. Should I place the $_POST in html instead of php? 3. Oh yes, I've found that the DOB is posted ok, however I've placed value="dd/mm/yyyy" as a temporary measure only. I'd be grateful for any ideas or guidance/help. Thank You very much.
  14. Hi, I am still a rookie when it comes to HTML and would like to create a form that has a single input field. I would like it to show a password field but whatever you type in it would add the html file extension to it and take you to that page. Example, Say you type monkey then click submit. It would take you to monkey.html which is a webpage within my website. Please help... I keep trying stuff and I am getting more confused the more I try it. Thank you Jesse
  15. Hi I have been putting in forms post in websites for a long time just started in the last few weeks to have a go at mobile website building using 3 of the w3c templates. which are terrific but one don't want to play. Its the form post I looked and tried many different ways to make the form work but its split with a div in removing the div the post works fine and looks good on website but not on mobile. I have put in a block form without the div of a different design post box which validates html4 but does not look as good, I want to keep the original post form in. Put the website through html tidy up which takes the <form/> and moves it to just after the action post. It validates to html4 but the form does not post.below is the offending scrip. <form action="mail99.php" method="POST"> <input type="text" value="Name" onfocus="this.value='';" onblur="if (this.value == '') {this.value = 'Name';}"> <div class="clear"> </div> </div> <div class="your-single"> <i class="email"> </i> <input type="text" value="E-mail" onfocus="this.value='';" onblur="if (this.value == '') {this.value = 'E-mail';}"> <div class="clear"> </div> </div> <div class="your-single"> <i class="website"> </i> <input type="text" value="Website" onfocus="this.value='';" onblur="if (this.value == '') {this.value = 'Website';}"> <div class="clear"> </div> </div> </div> <div class="grid-single-in"> <textarea name="message" cols="77" rows="5" value=" " onfocus="this.value='';" onblur="if (this.value == '') {this.value = 'Message';}">Message</textarea> <input type="submit" value="SENT MESSAGE"> </form> I put one form block in which worked fine but it totally alters the shape on mobile view. Would be pleased if any one could solve this problem keeping the div in place and being validated to HTML4/5 Thank you for your time a picture below
  16. I'm not very experienced in html. Is there a way to pass on text that is shown as a part of a form (not text that the user fill in, but text written by the programmer in the html-file), without having to write it as "value" in addition? I've checked the W3Schools.com, and tried to search google as well, but I can't find any information on this. I know I can do something like this: <td>Verb1<input type="hidden" name="Verb1" value="Verb1"></td> But is there a way of doing this without having to write the same twice in the html-coding?
  17. Hello; This is the first time I have posted to this forum. I have been developing javascript and php in web related context for some time. But there is always some detail that gets solved at some point, but solution is buried in old code somewhere. I am currently trying to get javascript to set a hidden field from the selection a user makes from a set of radio buttons. I have googled around and found some reference an a clue in "current value" but that won't fly in javascript, and the actual syntax was not provided...... SO: here is some code var closeSAOOpt = function() { var opt = document.forms.script.openOpt.currentValue alert(opt) } alert in code above produces "undefined". I know one of the radios is checked. I have varified that openOpt is in fact the radio group name and that it is assigned to both radio button name values. I know the document.forms.script is defined, and that javascript won't accept spaces in variable names. So I have assumed 'current value' is currentValue in javascrip But what "undefined" is referring to is often not obvious. The funtion above is called in an eventlistener attached to a button element labeled "Done" Can I get a hand with this from someone? Thank you for time and attention.
  18. Hi, I wonder why echo is needed in the following lite of code (for a safe form submission)? I have searched for an answer but everyone seems to discuss the htmlspecialchar thing, but noone explains the "echo". <form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> When I use this piece of code it results in a zero printed out on my website... Thanks a lot!
  19. Hello again! The last thing I am attempting to do for my 1st website is add a custom form that I made via https://coveloping.com/tools/html5-responsive-form-generator I was able to figure out how to get it to appear on my page however I didn't see an option in the builder to select which email the form should send to. I am assuming this will go into the HTML section and not the CSS section? +54 Karma points if you can assist me x) May The 4th Be With You.
  20. Hello, Im a bit lost with this project, I cant seem to find the problem and I sure could use an extra set of eyes to look it over. when the form is submitted it comes back to the error page and the emails are not sent. any ideas? Thanks in advance! <?phpfunction ValidateEmail($email){ $pattern = '/^([0-9a-z]([-.w]*[0-9a-z])*@(([0-9a-z])+([-w]*[0-9a-z])*.)+[a-z]{2,6})$/i'; return preg_match($pattern, $email);}if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['formid'] == 'form344'){ $mailto = $_POST['unit'];if(isset($_POST['unit'])) { $units['M17'][] = 'email@email.com, email@email.com'; $units['M16'][] = 'email@email.com'; $to = implode(",",$units[$_POST['unit']]); $mailfrom = isset($_POST['email']) ? $_POST['email'] : $mailto; $subject = 'Transfer'; $message = ''; $success_url = './success.php'; $error_url = './error.php'; $error = ''; $eol = "n"; $max_filesize = isset($_POST['filesize']) ? $_POST['filesize'] * 1024 : 1024000; $boundary = md5(uniqid(time())); $header = 'From: '.$mailfrom.$eol; $header .= 'Reply-To: '.$mailfrom.$eol; $header .= 'MIME-Version: 1.0'.$eol; $header .= 'Content-Type: multipart/mixed; boundary="'.$boundary.'"'.$eol; $header .= 'X-Mailer: PHP v'.phpversion().$eol; if (!ValidateEmail($mailfrom)) { $error .= "The specified email address is invalid!n<br>"; } if (!empty($error)) { $errorcode = file_get_contents($error_url); $replace = "##error##"; $errorcode = str_replace($replace, $error, $errorcode); echo $errorcode; exit; } $internalfields = array ("submit", "reset", "send", "filesize", "formid", "captcha_code", "recaptcha_challenge_field", "recaptcha_response_field"); $message .= $eol; foreach ($_POST as $key => $value) { if (!in_array(strtolower($key), $internalfields)) { if (!is_array($value)) { $message .= ucwords(str_replace("_", " ", $key)) . " : " . $value . $eol; } else { $message .= ucwords(str_replace("_", " ", $key)) . " : " . implode(",", $value) . $eol; } } } $body = 'This is a multi-part message in MIME format.'.$eol.$eol; $body .= '--'.$boundary.$eol; $body .= 'Content-Type: text/plain; charset=ISO-8859-1'.$eol; $body .= 'Content-Transfer-Encoding: 8bit'.$eol; $body .= $eol.stripslashes($message).$eol; if (!empty($_FILES)) { foreach ($_FILES as $key => $value) { if ($_FILES[$key]['error'] == 0 && $_FILES[$key]['size'] <= $max_filesize) { $body .= '--'.$boundary.$eol; $body .= 'Content-Type: '.$_FILES[$key]['type'].'; name='.$_FILES[$key]['name'].$eol; $body .= 'Content-Transfer-Encoding: base64'.$eol; $body .= 'Content-Disposition: attachment; filename='.$_FILES[$key]['name'].$eol; $body .= $eol.chunk_split(base64_encode(file_get_contents($_FILES[$key]['tmp_name']))).$eol; } } } $body .= '--'.$boundary.'--'.$eol; if ($mailto != '') { mail($mailto, $subject, $body, $header); }mail($mailto, $subject, $body, $header); header('Location: '.$success_url); exit;}}if (session_id() == ""){ session_start();}if (!isset($_SESSION['username'])){ header('Location: ./notloggedin.php'); exit;}if (isset($_SESSION['expires_by'])){ $expires_by = intval($_SESSION['expires_by']); if (time() < $expires_by) { $_SESSION['expires_by'] = time() + intval($_SESSION['expires_timeout']); } else { unset($_SESSION['username']); unset($_SESSION['expires_by']); unset($_SESSION['expires_timeout']); header('Location: ./notloggedin.php'); exit; }}if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['formid'] == 'form1'){ $mailto = $_POST['unit'];if(isset($_POST['unit'])) { $units['M17'][] = 'email@email.com, email@email.com'; $units['M16'][] = 'email@email.com'; $to = implode(",",$units[$_POST['unit']]); $mailfrom = isset($_POST['email']) ? $_POST['email'] : $mailto; $subject = '911'; $message = ''; $success_url = './success.php'; $error_url = './error.php'; $error = ''; $eol = "n"; $max_filesize = isset($_POST['filesize']) ? $_POST['filesize'] * 1024 : 1024000; $boundary = md5(uniqid(time())); $header = 'From: '.$mailfrom.$eol; $header .= 'Reply-To: '.$mailfrom.$eol; $header .= 'MIME-Version: 1.0'.$eol; $header .= 'Content-Type: multipart/mixed; boundary="'.$boundary.'"'.$eol; $header .= 'X-Mailer: PHP v'.phpversion().$eol; if (!ValidateEmail($mailfrom)) { $error .= "The specified email address is invalid!n<br>"; } if (!empty($error)) { $errorcode = file_get_contents($error_url); $replace = "##error##"; $errorcode = str_replace($replace, $error, $errorcode); echo $errorcode; exit; } $internalfields = array ("submit", "reset", "send", "filesize", "formid", "captcha_code", "recaptcha_challenge_field", "recaptcha_response_field"); $message .= $eol; foreach ($_POST as $key => $value) { if (!in_array(strtolower($key), $internalfields)) { if (!is_array($value)) { $message .= ucwords(str_replace("_", " ", $key)) . " : " . $value . $eol; } else { $message .= ucwords(str_replace("_", " ", $key)) . " : " . implode(",", $value) . $eol; } } } $body = 'This is a multi-part message in MIME format.'.$eol.$eol; $body .= '--'.$boundary.$eol; $body .= 'Content-Type: text/plain; charset=ISO-8859-1'.$eol; $body .= 'Content-Transfer-Encoding: 8bit'.$eol; $body .= $eol.stripslashes($message).$eol; if (!empty($_FILES)) { foreach ($_FILES as $key => $value) { if ($_FILES[$key]['error'] == 0 && $_FILES[$key]['size'] <= $max_filesize) { $body .= '--'.$boundary.$eol; $body .= 'Content-Type: '.$_FILES[$key]['type'].'; name='.$_FILES[$key]['name'].$eol; $body .= 'Content-Transfer-Encoding: base64'.$eol; $body .= 'Content-Disposition: attachment; filename='.$_FILES[$key]['name'].$eol; $body .= $eol.chunk_split(base64_encode(file_get_contents($_FILES[$key]['tmp_name']))).$eol; } } } $body .= '--'.$boundary.'--'.$eol;}}?>
  21. <button onclick="myfunction()">Submit</button><?phpfunction myfunction(){ golbal $qual; if (document.getElementById('nota1').checked) { $qual++}; if (document.getElementById('nota2').checked) { $qual++}; if (document.getElementById('nota3').checked) { $qual++; echo "Your score is: $qual out of 30"}; else {echo "First check the answers you think correct"};}?> I don't understand why this php snippet (which i have included in a html with a form in it) is wrong. When i click "Submit" button nothing happens.
  22. I am trying to build a rather large (16+ pages, 2,000+ fields) Survey form to use as part of my Inspection business. I kept being told "it can't be done" and being an old school hack, I thought it could be done... So I wrote a smaller "Proof of Concept" form that has most of the features I wanted... I used Abobe Acrobat XI and Javascript and LOTS of Google searches The form works...(Very well thank you) So now I want to find someone to re-write it (for Pay) nicely for real.... I have posted it on "eLance" but would like to know where else I could post it to find people interested in working on a really Nasty, large, complicated, Acrobat PFD Form with some interesting Javascript as well? Yes, I could do it, but that is not what I am good at... I am a Proof kind of Guy.... I show that it -can- be done, and then turn over the detail to someone who is detail oriented. (and writes neater code than I do) Be happy to post the Sample Form and the RFP here (if I can) so long as its understood that I know I am a hack, and it was PURELY a proof-of-concept exercise. The code is ugly, complicated, but it works... PS.. this forum was instrumental in figuring out how to do some of the "impossible" things...
  23. Is there a way to use a separate file for form processing if I want the results to appear on the same page, right below the form? Or do I have to leave all my PHP code in the page itself?
  24. Hi, I've just built a basic web site, but I now realise (by going through the process) that I need to understand other languages & processes in order to make the site streamlined & fully functional. Because I've only learnt html & css (on a basic level) my understanding of php, sql, js, xml, etc is very poor. I therefor need some advice on what the best mechanisms are for inputting data, storing it & displaying it on the web, possibly with some type of rss feed too. The basic process the site is doing, can be described as follows: 1. Users enter data using an online form. 2. Data is stored on a database & manually verified. 3. Certain info from the database is automatically displayed on the site (but not all) in a friendly viewable format. 4. Every time the site is updated a feed is created (like an rss or blog). The first two processes I have achieved, but I am exploring ways of achieving the 3rd & 4th processes. Any advice on what methods or languages would be best to use would be greatly appreciated. I'm happy to learn any coding required. The data set can be stored in various formats (xlsx, csv, ods, tsv, etc), its really a question of the best way to interpret it & automatically display it that I am exploring. Along with creating the feed. Thanks for any advice. Old Guy.
  25. I have a website I created by using WIX. I am trying to Create a Form for First Name, Last Name and E-mail address that I would like to Pass the First Name, Last Name and E-mail on to a URL: The URL http://www.mb103.com/lnk.asp?o=6189&c=71590&a=120164&s1=fname&s2=lname&s3=emaill/ The S1, S2 & S3 are sub ID fields. My Question is how do I get the s1, s2, & s3 data after hitting the submit button to be inserted in the url above. <!DOCTYPE html><html><body> <form method="get" action="http://www.mb103.com/lnk.asp?o=6189&c=71590&a=120164&s1=email&s2=email/">First Name: <input type="text" name="fname"><br><br>Last Name: <input type="text" name="lname"><br><br>E-mail: <input type="text" name="email"><br><br><input type="submit" value="Submit"></form> </body></html> Thanks.
×
×
  • Create New...