Hi guys,
I have the following question:
I have a file called displayEvents.php with button called edit which lead when hit to another page called editEvent.php which has a button called save.
my probelm is as follows.
when the button save is hit, I want to check if all fields on page(editEvent.php )are not empty, if no one is empty I save the data in a database table and go to another page(index.php), this works fine but the problem is when some fields are empty, I want to keep the same page loaded and ask user to fill all fields before saving, how can I do this?
thanks in advance.
Clarification:
I use a javascript function to chexk if all the fields are filled the problem is if the event is displayed and if I delete for example the event title and hit save, I go backo top the same page but I can still see the event title there, I want to go back to the same page but with event title field empty.
thanks again.
Help please!
Moderator: General Moderators
Help please!
Last edited by wafasn on Tue Apr 06, 2004 11:39 am, edited 1 time in total.
-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA
this is my love script, works well and gives ALL the possible errors if the fields are left blank.
Code: Select all
<?php
if ($name == "") {
$msg[] = "<br><font color=red>You did not fill-in a username.<br>";
} if (!ereg("^[_a-zA-Z0-9-]+$", $name)) {
$msg[] = "<br><font color=red>You did not fill-in a correct username.<br>";
} if ($passw == "") {
$msg[] = "<br><font color=red>You did not fill-in a password.<br>";
} if ($email == "") {
$msg[] ="<br><font color=red>You did not fill-in a email address. If you dont have one, please enter 'n/a' in the box.<br>";
} if ($aim == "") {
$msg[] = "<br><font color=red>You did not fill-in a aol screen name. If you dont have one, please enter 'n/a' in the box.<br>";
}
foreach($msg as $value) {
echo $value;
}
?>