| You are here: DEVPPL ‹ Forum ‹ Programming ‹ HTML Forum |
NOTIFICATIONS
|
|
|||||||||||||||
Login |
Mandatory Fields
9 posts
• Page 1 of 1
0
Mandatory Fields
How do I make an alert popup when a required field isn't filled in.
At the moment, info from my forms get sent even if the required fields aren't filled in.
At the moment, info from my forms get sent even if the required fields aren't filled in.
joshcxa
DEVPPL Lightwave Moderator
DEVPPL Lightwave Moderator
- Joshcxa
- Reputation: 0
- Posts: 156
- Joined: Wed Aug 18, 2004 11:59 am
- Location: Australia
- Highscores: 0
- Arcade winning challenges: 0
0
[php]<?php if($_POST['feildname] == "") {
echo "Your forgot to enter something in feildname";
}
?>[/php]
echo "Your forgot to enter something in feildname";
}
?>[/php]
Last edited by Rasmus Lindström on Wed Jul 27, 2005 4:07 pm, edited 1 time in total.
[url=http://www.linkedin.com/profile/view?id=96243938]Meet me on LinkedIn[/url]
[img]http://www.devppl.com/images/facebook_icon_small.jpg[/img] Help DEVPPL grow, [url=http://www.facebook.com/pages/DEVPPL/140524279390050]like DEVPPL on facebook[/url]!
[img]http://www.devppl.com/images/facebook_icon_small.jpg[/img] Help DEVPPL grow, [url=http://www.facebook.com/pages/DEVPPL/140524279390050]like DEVPPL on facebook[/url]!
- Rasmus Lindström
- Site Admin
- Reputation: 18
- Posts: 2830
- Joined: Tue Aug 17, 2004 2:07 pm
- Location: Sweden
- Highscores: 1
- Arcade winning challenges: 0
0
No it only shows the text: You forgot to enter something in fieldname.
But just change what it should echo, you can add html code in there to.
But just change what it should echo, you can add html code in there to.
[url=http://www.linkedin.com/profile/view?id=96243938]Meet me on LinkedIn[/url]
[img]http://www.devppl.com/images/facebook_icon_small.jpg[/img] Help DEVPPL grow, [url=http://www.facebook.com/pages/DEVPPL/140524279390050]like DEVPPL on facebook[/url]!
[img]http://www.devppl.com/images/facebook_icon_small.jpg[/img] Help DEVPPL grow, [url=http://www.facebook.com/pages/DEVPPL/140524279390050]like DEVPPL on facebook[/url]!
- Rasmus Lindström
- Site Admin
- Reputation: 18
- Posts: 2830
- Joined: Tue Aug 17, 2004 2:07 pm
- Location: Sweden
- Highscores: 1
- Arcade winning challenges: 0
0
And to make it even easier you can end the php, write the javascript as you want and then start the php again. Like this:
[php]<?php if($_POST['feildname] == "") { ?>
Standard HTML or Javascript here!
<?php
}
?>[/php]
[php]<?php if($_POST['feildname] == "") { ?>
Standard HTML or Javascript here!
<?php
}
?>[/php]
[url=http://www.linkedin.com/profile/view?id=96243938]Meet me on LinkedIn[/url]
[img]http://www.devppl.com/images/facebook_icon_small.jpg[/img] Help DEVPPL grow, [url=http://www.facebook.com/pages/DEVPPL/140524279390050]like DEVPPL on facebook[/url]!
[img]http://www.devppl.com/images/facebook_icon_small.jpg[/img] Help DEVPPL grow, [url=http://www.facebook.com/pages/DEVPPL/140524279390050]like DEVPPL on facebook[/url]!
- Rasmus Lindström
- Site Admin
- Reputation: 18
- Posts: 2830
- Joined: Tue Aug 17, 2004 2:07 pm
- Location: Sweden
- Highscores: 1
- Arcade winning challenges: 0
0
If you set the name on the submit-button to: hello
[php]<?php
if(isset($_POST['hello'])) {
if($_POST['url'] == "") { ?>
You forgot the enter something in the url-field
<?php
} elseif($_POST['mail'] == "") { ?>
You forgot the enter something in the mail-field
<?php
} else {
echo "The url is: " . $_POST['url'] . " and the mail is: " . $_POST['mail'];
}
} else { ?>
<form method......
........................
........................
</form>
<?php
}
?>[/php]
[php]<?php
if(isset($_POST['hello'])) {
if($_POST['url'] == "") { ?>
You forgot the enter something in the url-field
<?php
} elseif($_POST['mail'] == "") { ?>
You forgot the enter something in the mail-field
<?php
} else {
echo "The url is: " . $_POST['url'] . " and the mail is: " . $_POST['mail'];
}
} else { ?>
<form method......
........................
........................
</form>
<?php
}
?>[/php]
[url=http://www.linkedin.com/profile/view?id=96243938]Meet me on LinkedIn[/url]
[img]http://www.devppl.com/images/facebook_icon_small.jpg[/img] Help DEVPPL grow, [url=http://www.facebook.com/pages/DEVPPL/140524279390050]like DEVPPL on facebook[/url]!
[img]http://www.devppl.com/images/facebook_icon_small.jpg[/img] Help DEVPPL grow, [url=http://www.facebook.com/pages/DEVPPL/140524279390050]like DEVPPL on facebook[/url]!
- Rasmus Lindström
- Site Admin
- Reputation: 18
- Posts: 2830
- Joined: Tue Aug 17, 2004 2:07 pm
- Location: Sweden
- Highscores: 1
- Arcade winning challenges: 0
|
|