Jump to content

Search the Community

Showing results for tags 'errorsundefined index'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

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


Age


Donation Link

Found 1 result

  1. hi all ive been trying to do this validation thing for ages now where i want to check if the field is empty and if so ask them to fill it and then once its filled go to the next page but ive been having problems with this i had loads of errors but i got it down to one which im confused to hell about and even once i get this error out the way i still don't no if it does validate please help. <!DOCTYPE HTML> <html> <head> <style> .error {color: #FF0000;} </style> </head> <body> <? $con = mysqli_connect("localhost","root","","nib"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } mysqli_query($con,"INSERT INTO tbl_club_contacts (companyname, FirstName, Address1, Address2, Area, City); VALUES ('nelsons', 'luke', '', 'IT', '5 HIGHFIELD ROAD', 'LITTLEOVER', 'DERBY')"); mysqli_close($con); // define variables and set to empty values $companynameErr = $FirstNameErr = $Address1Err = $Address2Err = $AreaErr = $CityErr = ""; $companyname = $FirstName = $Address1 = $Address2 = $Area = $City = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") if($_POST['companyname']==null || $_POST['companyname']==""); { $allValid = false; } ?> <form action="insertaddleads.php" method="post"> <p><span class="error">* required field.</span></p> <form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> <table border = "0"> <tr> <td>companyname:</td> <td><input type="text" name="companyname"> <span class="error">* <?php echo $companynameErr;?></span></td> </tr> <tr> <td>FirstName:</td> <td><input type="text" name="firstname"> <span class="error">* <?php echo $FirstNameErr;?></span></td> </tr> <tr> <td>Address 1:</td> <td><input type="text" name="address1"> <span class="error">* <?php echo $Address1Err;?></span></td> </tr> <tr> <td>Address 2:</td><td><input type="text" name="address2"> <span class="error">* <?php echo $Address2Err;?></span></td> </tr> <tr> <td>Area:</td><td><input type="text" name="area"> <span class="error">* <?php echo $AreaErr;?></span></td> </tr> <tr> <td>City:</td> <td><input type="text" name="city"> <span class="error">* <?php echo $CityErr;?></span></td> </tr> <tr> <td><input type="submit" name="submit" value="Submit"></td> </tr> </form> <? echo $companyname; echo "<br>"; echo $FirstName; echo "<br>"; echo $Address1; echo "<br>"; echo $Address2; echo "<br>"; echo $Area; echo "<br>"; echo $City; echo "<br>"; ?> <?php foreach($_POST as $companyname=>$companyname) { if($fieldValue == '') { print "<div>$companyname is blank</div>"; } } ?> </body> </html> this is the second page <?php $con=mysqli_connect("localhost","root","","nib"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $sql="INSERT INTO tbl_club_contacts (CompanyName, FirstName, Address1, Address2, Area, City) VALUES ('$_POST[test]','$_POST[firstname]','$_POST[address1]','$_POST[address2]','$_POST[area]','$_POST[city]')"; if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } echo "record added"; mysqli_close($con); ?> <html> <body> <form action="addleads2.php" method="post"> <input type="submit", value = "go back"> </form> </body> </html> and then the error code ive been getting ( ! ) Notice: Undefined index: companyname in C:\wamp\www\AddLeads\addleads2.php on line 30
×
×
  • 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.