Jump to content

Trying to add new "required" field in PHP form


Mr.Canuck

Recommended Posts

I am trying to add another "required field" to my PHP form, but I'm not sure what I'm doing wrong. The form and "required fields" work fine, but I am now trying to make the "Select skill level which is an "input type="radio" as a required field, but it is not working. As you can see below, I just tried adding the new "required" field the same way as the other 4 were set up, but it is not working (I think I have to do something different because the new "required field" is a "radio" type and the rest are "text"). The relevant parts of the code are below. Any assistance would be appreciated :)

 

<script type="text/JavaScript">
function verify() {
var Skill = document.indiv_reg.skill.value;
var Fname = document.indiv_reg.name.value;
var Hphn = document.indiv_reg.home_num.value;
var Email = document.indiv_reg.email.value;
var Tname = document.indiv_reg.tname.value;

if ((Fname =="") || (Skill =="") || (Hphn =="") || (Email =="") || (Tname =="")) {
alert('Please Fill Out ALL Required Fields');
}
else {
document.indiv_reg.submit();
}
}
</script>

 

<?php
$url = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6Y76L7TX6FVRW";
$sport = $_GET['sport'];
$league = $_GET['league'];
$visitor = $_GET['name'];
$skill = $_GET['skill'];
$tname = $_GET['tname'];
$tcap = $_GET['tcap'];
$homephn = $_GET['home_num'];
$cellphn = $_GET['cell_num'];
<?php

 

* Denotes a Required Field<br />
<br />

							<form name="indiv_reg" method="GET" action="tourney_mailRedirect.php">
							Sport:<br />
							<input type="text" name="sport" value="'.$sport.'" readonly="readonly" /><br />
<br />
							Tournament:<br />
							<input type="text" size="90" name="league" value="'.$league.'" readonly="readonly" /><br />
<br />

							* Please select preferred skill level:<br />
							<input type="radio" name="skill" value="recreational" /> Recreational<br />
                                                                <input type="radio" name="skill" value="competitive" /> Competitive<br />
<br />								
							* Name:<br />
							<input type="text" name="name"  /><br />
<br />
							* Team Name:<br />
							<input type="text" name="tname"  /><br />
<br />							
							Team Captain:<br />
							<input type="text" name="tcap"  /><br />
<br />
							* Home Phone:<br />
							<input type="text" name="home_num"  /><br />
<br />
							Cell Phone:<br />

							<input type="text" name="cell_num"  /><br />
<br />
							* Email:<br />

							<input type="text" name="email"  /><br />
<br />

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.