Jump to content

Search the Community

Showing results for tags 'form validation'.

  • 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

Found 6 results

  1. So, I'm going through the tutorial https://www.w3schools.com/php/php_form_complete.asp and I thought I understood what was going on. But when I try to implement it, it goes haywire. So, I backed up, went through it again, I copied and pasted the EXACT file on the page, uploaded it to my webserver and ran it. I got this: What am i doing wrong? My webserver is running PHP 7.2
  2. I have a form written using HTML5 and CSS3, final validation is performed on submit with JavaScript. Then, the form will be sent to the server, most likely using PHP's mail() function. I don't recall how to include two items such as these in a form's action="...", I'd deeply appreciate if someone could refresh my memory! Thank you
  3. I'm learning php & sql. I can do the programming and logic, but how to put it all together is where I get confused. I have copied, from the w3 tutorial, the php form validation complete, and it worked fine. I have also used the php/sql database tutorial to copy the 'insert into' code and it works fine with a Db I set up on the local host. Now I would like to save the info in the form to a database table, but I'm not sure where to insert the code to connect to the database. I tried just adding the code at the bottom of the 'Form Complete' code but it didn't seem to take - no error codes but didn't get saved to the table. If I should keep it as a separate file, how and where do I call that file with the parameters I want to insert into the database? Is there anything on the w3 site that deals with this 'real life' situation. The tutorials are very good, but (everybody's got a big butt) the examples all use literals and they don't relate to a problem like I've explained here. I mean, why else would you have somebody fill in a form except to save the info in a table for future reference?? Any help going forward would be greatly appreciated. I didn't post the code here to save space, so if you're not sure what code I'm talking about, it's at w3schools and under PHP tutorial goto PHP forms 'Form Complete' and just below that in the SQL section is the code for Inserting data into a mySQL database. If I need to, I will post it. Thanx, Gil
  4. JohnJeans

    Form validation

    Hello everyone I'm trying to find out where is the problem in applying the PHP tutorial here on w3schools !!! in lesson validating an html form I apply it but it didn't work !!!! So I started from the beginning so I've created a very simple html form like this: <!DOCTYPE HTML> <html> <head> <title>th_1</title> <style> .error {color: #FF0000;} </style> </head> <body> <form method="post" action="tp_1.php"> <input type="text" name="Fname" ><span class="error"> * <?php echo $FnameErr;?></span> <p></p> <input type="submit" name="submit" value="Submit"> </form> </body> </html> and the tp_1.php is: <!DOCTYPE HTML> <html> <head> <title>tp_1</title> </head> <body> <?php // define variables and set to empty values $Fname = ""; $FnameErr = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["Fname"])) { $FnameErr = "Name is required"; } else { $Fname = test_input($_POST["Fname"]); } function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?> </body> </html> So, when I leave the text box blank instead I receive "Name is required" message next to the text box I receive Internal Server error..!!! Can anyone tell me where is the error..!!!!? Thank you all
  5. Is there any way that we can validate our form fields with CSS3. I know that with HTML5 we can.
  6. jimfog

    using trim

    Do you think that when I validate form with js I should use trim() for removing the whitespace or I should leave this entirely on server-side code?
×
×
  • Create New...