/    Sign up×
Community /Pin to ProfileBookmark

easy form validation

How can I require the following field in the submit form to be filled out?
[URL=”http://www.christiancountyvideo/jumploader/jumploader_start.php”]http://www.christiancountyvideo/jumploader/jumploader_start.php[/URL]
Here’s the code:

[CODE]<?php
session_start();
?>

<html>
<head><title>Christian County Video — Easy Upload Start</title></head>
<body bgcolor=#CCCCCC background=”../img/welcome.jpg” bgproperties=”fixed” text=”#000000″ link=”#0000EE” vlink=”#551A8B”>

<center>
<br><p><br>
<img src=”../img/legal.bmp” border=1><br><p><br>

<form method=post action=”mkdir.php”>
<table border=1 cellpadding=3 celspacing=3 align=center width=55%>

<tr><td colspan=2 align=center><?php if (isset($username)){if ($logout==false){if(isset($err)){echo “$err”;}}}?></td></tr>
<tr><td align=center>All of the rights to the music and the pictures belong to you. <br> All we do is organize it, put it on DVD, and send it to you. <br> If you agree, please enter your name below and click on “I Agree”.</td><tr>
<tr><td align=center>Your Name: <input type=text name=username size=”20″></td><tr>
<tr><td colspan=2 align=center><input type=submit value=”I AGREE”></td><tr>
</table>
</form>
</body>
</html>[/CODE]

Thanks!

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@NogDogApr 01.2007 — [code=php]
if(trim($_POST['username']) === '')
{
// handle error here for empty input...
}
else
{
// some value was entered, so continue processing...
}
[/code]
×

Success!

Help @benrussell spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...