Thanks Susen and Ronald.
I probably used a combination of both your suggestions. The real problem is my lack of understanding. I used PHP Solutions by David Powers and the explanations are what I needed more than the code itself. I did end up using an array as Ronald suggested. I'll show the code for your information. Again. Thank you, both, for your attention and help. -Louis
[PHP]// list expected fields
...
User Profile
Collapse
-
Thanks Devsusen. I really appreciate you taking the time to help me. My first thoughts are this: I'd prefer to stay with PHP since I wouldn't have to deal with javascript being enabled, disabled, etc on the client side. I formed these opinions from the vast internet searching I do and the the postings that are out there. However, perhaps you can share with me your experience with javascript vs. PHP to further broaden my opinions. I'm totally...Leave a comment:
-
Here is my code with the added suggestions Ronald gave. It does produce the error msgs when fields are empty, however, I can not post a comment now even when all fields are filled. Here is the updated code.
[PHP]<?php
// open connection to database
include("db_con nect.php");
// get post_id from query string
$post_id = (isset($_REQUES T["post_id"]))?$_REQUEST["post_id"]:"";...Leave a comment:
-
Thanks Ronald, I did follow your guidance. I created the $errors array, verified the form fields and followed the IF ELSE logic....I also did some research on IMPLODE....beca use I have no clue what that is. Now, when I post with one of the form fields empty, I get the error page.....but a list like this
Please correct the following errors:
xname
xmail
xcomment
Please enter your email
...Leave a comment:
-
Bedankt Ronald. You are right, I should have provided my entire code. Here it is. I did what you said, and I understand putting the errors into an array and creating an if statement with !errors.....but I got a parse error with an unexpected "else" statement....an d I'm so new to this that I figured I should have given you the whole code instead! What you're seeing is the code BEFORE I tried to get a validation of NAME and COMMENT fields...Leave a comment:
-
Actually just discovered my solution doesn't work. when I press submit with Name and Comment fields empty....it auto populates with some other name...perhaps the name I had last entered. I've been working on this for 5 days and I'm completely lost. I just want to stop submission if Name and Comment are empty, deliver an error message for the field that is empty, retain the field in the event of an error (so users who forget name, don't have to...Leave a comment:
-
Advice on a PHP form submission/error msg solution I created
I would be very appreciative of anyone who could show me a better way to do what I did. Complete newbee here. I have a comment form sidebar of blog. I wanted to Name & Comment fields required and give error msgs when empty upon submit. AND wanted to make sure the comment wasn't lost in the event of an error. Here's what I did:
[PHP]
// Check to make sure Name & Comment are NOT empty
$name = trim($_POST['name']);...
No activity results to display
Show More
Leave a comment: