Вы находитесь на странице: 1из 56

Developing a School Cricket Team Application

Module
Server Side Web Programming

Noorulebbe Mohamed Riyas ID: S0411KDKD0410

Lecturer: Chandranna Rayadurg

School of Technology and Management BSC (HONS) Computer Studies Semester 04 JUN 2011

1. HTML form This is my application URL http://lsccricket.site11.com/

Screen shot of school cricket team application

Screen shot of cricket_team_application.php that is invoked when students submit the above form

2. When user click Edit button on the PHP page above, user will get an interface with the data which entered already by user Screen shot of the cricket_team.php

When user click confirm button on the cricket_team_application.php, user will see a simple message as Thank you! your details have been confirmed.

3. When user click confirm button on the cricket_team.php, the data is saved using save_application.php, so, below you can see the data of sakir manaf is saved and can be seen using view_cricket_team.php

Applicant sakir manaf details have been added to the very last row of database..

When user click on any name of view_cricket_team.php, user will see an interface with all the data which user submitted already can be edited and uploaded again.

Screen shot of Edit_student_details.php

When user click on the update button of above view_cricket_team.php, user will see a simple message Thank you! Your details have been updated successfully.

Screen shot of that page

Using Java Script to validate every input field:When user forget to enter his Student ID, a simple message generated by embedded java script wont allow him to submit the form until he fill out the student ID field,

When user forget to enter his Full Name, a simple message generated by embedded java script wont allow him to submit the form until he fill out the Full Name field,

When user forget to enter his Phone number, a simple message generated by embedded java script wont allow him to submit the form until he fill out the Phone field,

When user forget to select his Preferred batting position, a simple message generated by embedded java script wont allow him to submit the form until he fill out the batting position field,

Coding for cricket_team_application.html

<html> <HEAD>

<SCRIPT LANGUAGE='JavaScript'> <!-- Original: <!-- Web Site: Ronnie T. Moore --> The JavaScript Source -->

<!-- Dynamic 'fix' by: Nannette Thacker --> <!-- Web Site: http://www.shiningstar.net -->

<!-- This script and many more are available free online at -> <!-- Reference for this text area characters remaining check The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin function textCounter(field, countfield, maxlimit) { if (field.value.length > maxlimit) // if too long...trim it! field.value = field.value.substring(0, maxlimit); // otherwise, update 'characters left' counter else countfield.value = maxlimit - field.value.length; } // End --> </script>

<script language='JavaScript' type='text/javascript'> <!-function checkform ( form ) {

// http://www.thesitewizard.com/archive/validation.shtml // reference for the java script below

// set var radio_choice to false var radio_choice = false;

if (form.student_id.value=="") { alert("Student ID must be filled out"); form.student_id.focus(); return false; }

else if (form.full_name.value=="") { alert("Full Name must be filled out"); form.full_name.focus(); return false; }

else if (form.phone_numb.value=="") { alert("Please enter your phone number"); form.phone_numb.focus(); return false; }

// Loop from zero to the one minus the number of radio button selections // http://www.codeave.com/javascript/code.asp?u_log=7049 // Reference for this code to check the radio button

for (counter = 0; counter <form.bat_pos.length; counter++) {

// If a radio button has been selected it will return true // (If not it will return false) if (form.bat_pos[counter].checked) radio_choice = true; } if (!radio_choice) { // If there were no selections made display an alert box alert("Please select your prefereed batting position"); return (false); }

} </script > <style> table { position: absolute; top: 100px; left: 390px;} table {FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; TEXT-DECORATION: none;} table { -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; } input {FONT-SIZE: 12px; COLOR: #3B00BA; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; font-weight: bold; } input { -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; } textarea { -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; } th {FONT-SIZE: 14px;} </style>

</HEAD>

<body>

<form name='cric_form' method='POST' action='cricket_team_application.php' onsubmit="return checkform(this);" >

<table

cellpadding='5' bgcolor='#ACD3F2'>

<tr><th colspan='100' >SCHOOL CRICKET TEAM APPLICATION</th><tr/> <tr><th align='left'>PERSONAL</th><tr/> <tr> <td>Student ID</td> <td>:<input type='text' name='student_id'size='25'/></td> <tr/> <tr> <td>Full Name</td> <td>:<input type='text' name='full_name' size='60'/></td> <tr/> <tr> <td>Phone</td> <td>:<input type='text' name='phone_numb' size='25'/></td> <tr/> <tr height='20'/>

<tr><th align='left'>BATTING</th</tr> <tr> <td>Prefered Position </td> <td>:<input type='radio' name='bat_pos' value='opener'/>Opener <input type='radio' name='bat_pos' value='middle'/> Middle

<input type='radio' name='bat_pos' value='tail ender'/> Tail ender </td> </tr> <tr> <td>Style </td> <td>:<input type='radio' name='bat_style' value='left hand batsman'/>Left <input type='radio' name='bat_style' value='right hand batsman'/> Right</td> </tr> <tr height='20'/>

<tr><th align='left'>BOWLING</th></tr> <tr> <td>Type </td> <td>:<input type='radio' name='bowling_type' value='fast bowler'/> Fast <input type='radio' name='bowling_type'/ value='off spinner'> Off Spinner <input type='radio' name='bowling_type' value='leg spinner'/> Leg Spinner </td> </tr> <tr> <td>Style</td> <td>:<input type='radio' name='bowling_style' value='Left Hand bowler'/> Left <input type='radio' name='bowling_style' value='Right Hand bowler'/> Right</td> </tr>

<tr> <th align='left'>Wicketkeeper</th> <td>:<input type='checkbox' name='wicket_keeper' /></td> </tr> <tr> <td align='center' colspan='100'> <b>Brief Statement why should we select you to play for school team<b/></td> </tr>

<tr><td colspan='100'> <center>

<font size='1' face='arial, helvetica, sans-serif'> ( You may enter up to 200 characters. )<br> <textarea name=b_statement wrap=physical cols=62 rows=6 onKeyDown='textCounter(this.form.b_statement,this.form.re mLen,200);' onKeyUp='textCounter(this.form.b_statement,this.form.remL en,200);'></textarea> <br> <input readonly type=text name=remLen size=3 maxlength=3 value='200'> characters left</font>

</center></td></tr> <!-- textCounter() parameters are: field, the count field, max length --> text

<tr><td ><input type='Submit' name='Submit' value='Submit' </td> <td><input type='reset'/></td></tr>

</form> </table>

</body>

</html>

Coding for criket_team_application.php


<html> <head> <style> <style> table { position: absolute; top: 100px; left: 390px;} table {FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; TEXTDECORATION: none;} table {background: rgb(219,229,237); /* Old browsers */ background: -moz-linear-gradient(left, rgba(219,229,237,1) 0%, rgba(125,144,153,1) 100%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(219,229,237,1)), colorstop(100%,rgba(125,144,153,1))); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(left, rgba(219,229,237,1) 0%,rgba(125,144,153,1) 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(left, rgba(219,229,237,1) 0%,rgba(125,144,153,1) 100%); /* Opera11.10+ */ background: -ms-linear-gradient(left, rgba(219,229,237,1) 0%,rgba(125,144,153,1) 100%); /* IE10+ */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#dbe5ed', endColorstr='#7d9099',GradientType=1 ); /* IE6-9 */ background: linear-gradient(left, rgba(219,229,237,1) 0%,rgba(125,144,153,1) 100%); /* W3C */} th {FONT-SIZE: 13px; COLOR: #000000; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; TEXTDECORATION: none; } </style> </head>

<body>

<?php $student_id = $_POST['student_id']; $full_name =$_POST['full_name']; $phone_numb=$_POST['phone_numb']; $bat_pos = $_POST['bat_pos']; $bat_style = $_POST['bat_style']; $bowling_type = $_POST['bowling_type']; $bowling_style = $_POST['bowling_style']; if(isset($_POST['wicket_keeper'])) $wicket_keeper = "Yes"; else $wicket_keeper = "No"; $b_statement = $_POST['b_statement']; echo " <form name=user_details method='POST' action='cricket_team.php'> <table cellpadding='8' cellspacing='1' align='center'> <tr bgcolor='#E6E6E6'><th colspan='100'>You details as follow</th></tr> <tr bgcolor='#C9C9C9'><th align='left'>Your Student ID Number is </th><td>: $student_id</td></tr> <tr bgcolor='#E6E6E6'><th align='left'>Your Full Name is </th><td>: $full_name</td></tr> <tr bgcolor='#C9C9C9'><th align='left'>Your Phone Number is </th><td>: $phone_numb </td></tr> <tr bgcolor='#E6E6E6'><th align='left'>Your preferred Batting Position is </th><td>: $bat_pos </td></tr>

<tr bgcolor='#C9C9C9'><th align='left'>Your Batting Style is </th><td>: $bat_style </td></tr> <tr bgcolor='#E6E6E6'><th align='left'>Your Bowling Type is </th><td>: $bowling_type </td></tr> <tr bgcolor='#C9C9C9'><th align='left'>Your Bowling Style is </th><td>: $bowling_style </td></tr> <tr bgcolor='#E6E6E6'><th align='left'>Playing as a wicket keeper </th><td>: $wicket_keeper </td></tr> <tr bgcolor='#C9C9C9'><th colspan='100' align='center'>Your Statement as follow </th></tr> <tr bgcolor='#E6E6E6'><td colspan='100' align='left' width='50'> <font color='blue'> $b_statement</font></td></tr> <tr height='20'></tr> <input type='hidden' value=$student_id> <input type='hidden' value=$full_name> <input type='hidden' value=$phone_numb> <input type='hidden' <input type='hidden' value=$bat_style> <input type='hidden' value=$bowling_type> <input type='hidden' value=$bowling_style> <input type='hidden' value=$wicket_keeper> <input type='hidden' value=$b_statement> name='student_id' name='full_name' name='phone_numb' name='bat_pos' value=$bat_pos> name='bat_style' name='bowling_type' name='bowling_style' name='wicket_keeper' name='b_statement'

<tr><td colspan='0'><input type='submit' name='Submit' value='Confirm'/> <input type='submit' value='Edit'</td></tr> <table/> </form>" ?>

<body/> <html/>

Coding for Save_application.php

<html>

<head> </head> <body> <?php

$student_id = $_POST['student_id']; $full_name = $_POST['full_name']; $phone_numb = $_POST['phone_numb']; $bat_pos = $_POST['bat_pos']; $bat_style = $_POST['bat_style']; $bowling_type = $_POST['bowling_type']; $bowling_style = $_POST['bowling_style'];

if(isset($_POST['wicket_keeper']))

$wicket_keeper = "Yes"; else $wicket_keeper = "No";

$b_statement = $_POST['b_statement']; $button=$_POST['Submit'];

$con=mysql_connect("mysql13.000webhost.com","a2140952_riy as","password123")

or die(mysql_error()); mysql_select_db('a2140952_cricket');

if($button=='Confirm') { $insert=("INSERT INTO applicants (student_id, full_name, phone_numb, bat_pos, bat_style, bowling_type, bowling_style, wicket_keeper, b_statement) VALUES('$student_id', '$full_name', '$phone_numb', '$bat_pos', '$bat_style', '$bowling_type', '$bowling_style', '$wicket_keeper', '$b_statement')");

mysql_query($insert)

or die(mysql_error());

if(mysql_affected_rows()>0) { echo "<br/><h3>Thank you! Your details have been confirmed</h3>"; } else{ echo "</br><h3>Error in process<h3>"; }

else

{ $studentid=$_POST['studentid']; $update="update applicants set student_id='$student_id', full_name='$full_name', phone_numb='$phone_numb', bat_pos='$bat_pos', bat_style='$bat_style', bowling_type='$bowling_type', bowling_style='$bowling_style', wicket_keeper='$wicket_keeper', b_statement='$b_statement' where student_id='$studentid'";

mysql_query($update) or die(mysql_error());

if(mysql_affected_rows()>0) { echo "<br/><h3>Thank you! Your details have been updated successfully</h3>"; } else{ echo "</br><h3>Error in process<h3>"; }

mysql_close($con);

?> <p><a href="view_cricket_team.php">click here to see all applicants details</a></p>

</body> </html>

Coding for Cricket_team.php

<html> <head>

<SCRIPT LANGUAGE="JavaScript"> <!-- Original: <!-- Web Site: Ronnie T. Moore --> The JavaScript Source -->

<!-- Dynamic 'fix' by: Nannette Thacker --> <!-- Web Site: http://www.shiningstar.net -->

<!-- This script and many more are available free online at -> <!-- The JavaScript Source!! http://javascript.internet.com ->

<!-- Begin function textCounter(field, countfield, maxlimit) { if (field.value.length > maxlimit) // if too long...trim it! field.value = field.value.substring(0, maxlimit); // otherwise, update 'characters left' counter else countfield.value = maxlimit - field.value.length; } // End --> </script>

<script language='JavaScript' type='text/javascript'> <!-function checkform ( form ) {

// http://www.thesitewizard.com/archive/validation.html // reference for the java script below

// set var radio_choice to false var radio_choice = false;

if (form.student_id.value=="") { alert("Student ID must be filled out"); form.student_id.focus(); return false; }

else if (form.full_name.value=="") { alert("Full Name must be filled out"); form.full_name.focus(); return false; }

else if (form.phone_numb.value=="")

{ alert("Please enter your phone number"); form.phone_numb.focus(); return false; }

// Loop from zero to the one minus the number of radio button selections // http://www.codeave.com/javascript/code.asp?u_log=7049 // Reference for this code to check the radio button

for (counter = 0; counter <form.bat_pos.length; counter++) {

// If a radio button has been selected it will return true // (If not it will return false) if (form.bat_pos[counter].checked) radio_choice = true; } if (!radio_choice) { // If there were no selections made display an alert box alert("Please select your prefereed batting position"); return (false); }

</script >

<style>

table {FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; TEXT-DECORATION: none;}

input {FONT-SIZE: 12px; COLOR: #3B00BA; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; font-weight: bold; }

th {FONT-SIZE: 14px;} </style> <head> <title>SCHOOL CRICKET TEAM APPLICATION</title> </head> <body>

<?php $student_id=$_POST['student_id']; $full_name=$_POST['full_name']; $phone_numb=$_POST['phone_numb']; $bat_pos=$_POST['bat_pos']; $bat_style=$_POST['bat_style']; $bowling_type=$_POST['bowling_type'];

$bowling_style=$_POST['bowling_style']; $wicket_keeper=$_POST['wicket_keeper']; $b_statement=$_POST['b_statement']; ?>

<form method="POST" action="save_application.php" name="form_cricket_team_application" onsubmit="return checkform(this);" > <table bordercolor="#000" align="center"> <tr><th colspan="2">SCHOOL CRICKET TEAM APPLICATION </th></tr> <tr><th colspan="2" rowspan="2"><FONT COLOR="GREEN"><b>CONFIRMATION</b></FONT></th></tr> <tr height="20"> <tr><th align="left" >PERSONAL</TD></tr>

<tr> <td>Student ID:</td><td><input type="text" name="student_id" value="<?php echo $student_id; ?>" ></td> </tr> <tr> <td>Full Name:</td><td><input type="text" name='full_name' value='<?php echo $full_name; ?>'</td> </tr> <tr> <td>Phone:</td><td><input type="text" name="phone_numb" value="<?php echo $phone_numb; ?>" </td> </tr> <tr height="20"> <tr><th align="left">BATTING</TH></tr>

<tr> <td>Preferred Position</td> <td><?php if($bat_pos == "Opener") { echo ' <input type="radio" name="bat_pos" value="Opener" checked/>Opener <input type="radio" name="bat_pos" value="Middle" />Middle <input type="radio" name="bat_pos" value="Tail_ender" /> Tail ender'; } else if($bat_pos == "Middle") { echo ' <input type="radio" name="bat_pos" value="Opener" />Opener <input type="radio" name="bat_pos" value="Middle" checked/>Middle <input type="radio" name="bat_pos" value="Tail_ender" /> Tail ender'; } else { echo ' <input type="radio" name="bat_pos" value="Opener" />Opener

<input type="radio" name="bat_pos" value="Middle" />Middle <input type="radio" name="bat_pos" value="Tail_ender" checked/> Tail ender'; } ?></td></tr>

<tr> <td>Style:</td> <td><?php if($bat_style == "Left") { echo '<input type="radio" name="bat_style" value="left_hand_batsman" checked/>Left <input type="radio" name="bat_style" value="right_hand_batsman" /> Right'; } else { echo '<input type="radio" name="bat_style" value="left_hand_batsman" />Left <input type="radio" name="bat_style" value="right_hand_batsman" checked/>Right'; } ?></td></tr>

<tr height="20"> <tr><th align="left">BOWLING</TH></tr> <tr>

<td>Type:</td> <td><?php if($bowling_type == "fast_bowler") { echo ' <input type="radio" name="bowling_type" value="fast_bowler" checked/>Fast <input type="radio" name="bowling_type" value="off_spinner" />Off Spinner <input type="radio" name="bowling_type" value="leg_spinner" /> Leg Spinner'; } else if($bowling_type == "off_spinner") { echo ' <input type="radio" name="bowling_type" value="fast_bowler" />Fast <input type="radio" name="bowling_type" value="off_spinner" checked/>Off Spinner <input type="radio" name="bowling_type" value="leg_spinner"/> Leg Spinner'; } else { echo ' <input type="radio" name="bowling_type" value="fast_bowler" />Fast <input type="radio" name="bowling_type" value="off_spinner"/>Off Spinner <input type="radio" name="bowling_type" value="leg_spinner" checked/> Leg Spinner';

} ?></td></tr>

<tr> <td>Style:</td> <td><?php if($bowling_style == "Left_Hand_bowler") { echo '<input type="radio" name="bowling_style" value="Left_Hand_bowler" checked/>Left <input type="radio" name="bowling_style" value="Right_Hand_bowler" /> Right'; } else { echo '<input type="radio" name="bowling_style" value="Left_Hand_bowler" />Left <input type="radio" name="bowling_style" value="Right_Hand_bowler" checked/>Right'; } ?></td></tr>

<tr> <th align="left">Wicketkeeper:</th> <td><?php if($wicket_keeper == "Yes") { echo '<input type="checkbox" name="wicket_keeper" checked="checked"<br/>';

} else { echo '<input type="checkbox" name="keeper" />'; } ?></td></tr>

<tr height="20"> <tr> <td align="center" colspan="100">Your Statement as follow:</td> </tr> <tr><td colspan="100"> <center>

<font size="1" face="arial, helvetica, sans-serif"> ( You may enter up to 200 characters. )<br> <textarea name=b_statement wrap=physical cols=62 rows=6 onKeyDown="textCounter(this.form.b_statement,this.form.re mLen,200);" onKeyUp="textCounter(this.form.b_statement,this.form.remL en,200);"><?php echo $b_statement;?></textarea> <br> <input readonly type=text name=remLen size=3 maxlength=3 value="200">

characters left</font>

</center></td></tr>

<tr> </tr> <tr> <td></td><td> <input type="Submit" name="Submit" value="Confirm"></td> </tr> </table> </form> </body> </html>

Coding for view_cricket_team.php

<html> <head> <style> table {FONT-SIZE: 13px; COLOR: #000000; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; TEXT-DECORATION: none;}

th {FONT-SIZE: 14px; COLOR: #3B00BA;} h1 {FONT-SIZE: 22px; COLOR: #3B00BA;}

table {background: #ebf1f6; /* Old browsers */ background: -moz-linear-gradient(top, #ebf1f6 0%, #abd3ee 45%, #89c3eb 53%, #d5ebfb 100%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ebf1f6), color-stop(45%,#abd3ee), colorstop(53%,#89c3eb), color-stop(100%,#d5ebfb)); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(top, #ebf1f6 0%,#abd3ee 45%,#89c3eb 53%,#d5ebfb 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(top, #ebf1f6 0%,#abd3ee 45%,#89c3eb 53%,#d5ebfb 100%); /* Opera11.10+ */ background: -ms-linear-gradient(top, #ebf1f6 0%,#abd3ee 45%,#89c3eb 53%,#d5ebfb 100%); /* IE10+ */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ebf1f6', endColorstr='#d5ebfb',GradientType=0 ); /* IE6-9 */ background: linear-gradient(top, #ebf1f6 0%,#abd3ee 45%,#89c3eb 53%,#d5ebfb 100%); /* W3C */} </style> </head>

<body> <h1 align="center">Applicants details</h1> <?php $con=mysql_connect('mysql13.000webhost.com','a2140952_riyas',' password123') or die(mysql_error()); mysql_select_db('a2140952_cricket'); $result=mysql_query("select * from applicants"); echo "<table border='1.0' align='center'> <tr>

<th>STUDENT ID</th> <th>FULL NAME</th> <th>PHONE NUMBER</th> <th>BATTING POS</th> <th>BATTING STYLE</th> <th>BOWLING TYPE</th> <th>BOWLING STYLE</th> <th>WICKET KEEPER</th> <th >STATEMENT</th>

</tr>";

while($row=mysql_fetch_assoc($result)) echo "<tr>

<td>$row[student_id]</td>

<td><a href='edit_student_details.php?studentid=$row[student_id]'>$ro w[full_name]</a></td> <td>$row[phone_numb]</td> <td>$row[bat_pos]</td> <td>$row[bat_style]</td> <td>$row[bowling_type]</td> <td>$row[bowling_style]</td> <td>$row[wicket_keeper]</td> <td>$row[b_statement]</td> <td><a href='delete_student.php?studentid=$row[student_id]'>DELETE</a ></td>

</tr>";

echo "</table>"; echo "<p>&nbsp;</p>"; echo "<center><a href='cricket_team_application.html'>Click Here go back to Application</a></center>"; mysql_close($con); ?>

</body> </html>

Coding for editing_student_details.php

<html> <head>

<SCRIPT LANGUAGE="JavaScript"> <!-- Original: <!-- Web Site: Ronnie T. Moore --> The JavaScript Source -->

<!-- Dynamic 'fix' by: Nannette Thacker --> <!-- Web Site: http://www.shiningstar.net -->

<!-- This script and many more are available free online at -> <!-- The JavaScript Source!! http://javascript.internet.com ->

<!-- Begin function textCounter(field, countfield, maxlimit) { if (field.value.length > maxlimit) // if too long...trim it! field.value = field.value.substring(0, maxlimit); // otherwise, update 'characters left' counter else countfield.value = maxlimit - field.value.length; } // End --> </script>

<script language='JavaScript' type='text/javascript'> <!-function checkform ( form ) {

// http://www.thesitewizard.com/archive/validation.shtml // reference for the java script below

// set var radio_choice to false var radio_choice = false; if (form.student_id.value=="") { alert("Student ID must be filled out"); form.student_id.focus(); return false; } else if (form.full_name.value=="") { alert("Full Name must be filled out"); form.full_name.focus(); return false; } else if (form.phone_numb.value=="") { alert("Please enter your phone number"); form.phone_numb.focus();

return false; } // Loop from zero to the one minus the number of radio button selections // http://www.codeave.com/javascript/code.asp?u_log=7049 // Reference for this code to check the radio button

for (counter = 0; counter <form.bat_pos.length; counter++) { // If a radio button has been selected it will return true // (If not it will return false) if (form.bat_pos[counter].checked) radio_choice = true; } if (!radio_choice) { // If there were no selections made display an alert box alert("Please select your prefereed batting position"); return (false); } } </script > <style> table {background: rgb(233,240,245); /* Old browsers */ background: -moz-linear-gradient(left, rgba(233,240,245,1) 0%, rgba(134,194,234,1) 43%, rgba(169,210,237,1) 66%, rgba(209,233,251,1) 100%); /* FF3.6+ */

background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(233,240,245,1)), colorstop(43%,rgba(134,194,234,1)), colorstop(66%,rgba(169,210,237,1)), colorstop(100%,rgba(209,233,251,1))); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(left, rgba(233,240,245,1) 0%,rgba(134,194,234,1) 43%,rgba(169,210,237,1) 66%,rgba(209,233,251,1) 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(left, rgba(233,240,245,1) 0%,rgba(134,194,234,1) 43%,rgba(169,210,237,1) 66%,rgba(209,233,251,1) 100%); /* Opera11.10+ */ background: -ms-linear-gradient(left, rgba(233,240,245,1) 0%,rgba(134,194,234,1) 43%,rgba(169,210,237,1) 66%,rgba(209,233,251,1) 100%); /* IE10+ */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e9f0f5', endColorstr='#d1e9fb',GradientType=1 ); /* IE6-9 */ background: linear-gradient(left, rgba(233,240,245,1) 0%,rgba(134,194,234,1) 43%,rgba(169,210,237,1) 66%,rgba(209,233,251,1) 100%); /* W3C */}

table {FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; TEXT-DECORATION: none;} input {FONT-SIZE: 12px; COLOR: #3B00BA; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; font-weight: bold; } th {FONT-SIZE: 14px;}

</style> </head> <?php

$studentid=$_GET['studentid']; $con=mysql_connect('mysql13.000webhost.com','a2140952_riyas',' password123') or die(mysql_error()); mysql_select_db('a2140952_cricket'); $result=mysql_query("select * from applicants where student_id='$studentid'");

$row=mysql_fetch_assoc($result);

?> <form method='POST' action='save_application.php' onsubmit="return checkform(this);"> <table bordercolor='#3B00BA' cellpadding='5' align='center'>

<tr><th colspan='100' >My Info</th><tr/> <tr><th align='left'>PERSONAL</th><tr/> <tr> <td>Student ID</td> <td>:<input type='text' name='student_id'size='25' value=<?php echo "$row[student_id]" ?>></td> <tr/> <tr> <td>Full Name</td> <td>:<input type=text name='full_name' size='50' value=<?php echo"$row[full_name]" ?>></td> <tr/>

<tr> <td>Phone</td> <td>:<input type='text' name='phone_numb' size='25' value=<?php echo "$row[phone_numb]"?>></td> <?php echo "<input type='hidden' name='studentid' value=$studentid /></td>" ?> <tr/> <tr height='20'/>

<tr><th align='left'>BATTING</th</tr> <tr><td>Prefered batting position </td> <td><?php if($row["bat_pos"] == "Opener") { echo ' <input type="radio" name="bat_pos" value="Opener" checked/>Opener <input type="radio" name="bat_pos" value="Middle" />Middle <input type="radio" name="bat_pos" value="Tail ender" /> Tail ender'; } else if($row["bat_pos"] == "Middle") { echo ' <input type="radio" name="bat_pos" value="Opener" />Opener <input type="radio" name="bat_pos" value="Middle" checked/>Middle

<input type="radio" name="bat_pos" value="Tail ender" /> Tail ender'; } else { echo ' <input type="radio" name="bat_pos" value="Opener" />Opener <input type="radio" name="bat_pos" value="Middle" />Middle <input type="radio" name="bat_pos" value="Tail ender" checked/> Tail ender'; } ?></td></tr>

<tr> <td>Style:</td> <td><?php if($row["bat_style"] == "Left hand batsman") { echo '<input type="radio" name="bat_style" value="left hand batsman" checked/>Left <input type="radio" name="bat_style" value="right hand batsman" /> Right'; } else { echo '<input type="radio" name="bat_style" value="left hand batsman" />Left

<input type="radio" name="bat_style" value="right hand batsman" checked/>Right'; } ?></td></tr>

<tr height='20'/>

<tr><th align='left'>BOWLING</th></tr> <tr> <td>Type </td>

<?php if($row["bowling_type"] == "fast bowler") {echo "<td>:<input type='radio' name='bowling_type' value='fast bowler' checked/> Fast <input type='radio' name='bowling_type' value='off spinner'/> Off Spinner <input type='radio' name='bowling_type' value='leg spinner'/> Leg Spinner </td> </tr>"; } else if($row["bowling_type"] == "off spinner") {echo "<td>:<input type='radio' name='bowling_type' value='fast bowler' /> Fast

<input type='radio' name='bowling_type' value='off spinner' checked/> Off Spinner <input type='radio' name='bowling_type' value='leg spinner'/> Leg Spinner </td> </tr>"; } else {echo "<td>:<input type='radio' name='bowling_type' value='fast bowler' /> Fast <input type='radio' name='bowling_type' value='off spinner' /> Off Spinner <input type='radio' name='bowling_type' value='leg spinner' checked/> Leg Spinner </td> </tr>" ; } ?>

<tr> <td>Style</td> <?php if($row["bowling_style"] == "Left Hand bowler") {echo "<td>:<input type='radio' name='bowling_style' value='Left Hand bowler' checked/> Left <input type='radio' name='bowling_style' value='Right Hand bowler'/> Right</td> </tr>";}

else {echo "<td>:<input type='radio' name='bowling_style' value='Left Hand bowler' /> Left <input type='radio' name='bowling_style' value='Right Hand bowler' checked/> Right</td> </tr>";} ?>

<tr> <th align='left'>Wicketkeeper</th>

<?php if($row['wicket_keeper'] == 'Yes') {echo "<td>:<input type='checkbox' name='wicket_keeper' checked/>

</tr>"; } else {echo "<td>:<input type='checkbox' name='wicket_keeper' /></td>"; } ?> </tr> <tr>

<td align='center' colspan='100'> <b>Brief Statement why should we select you to play for school team<b/></td> </tr>

<tr><td colspan='100'> <center> <form name=myform action='YOURSCRIPT.CGI'> <font size='1' face='arial, helvetica, sans-serif'> ( You may enter up to 200 characters. )<br> <textarea name='b_statement' wrap='physical' cols='62' rows='6' onKeyDown='textCounter(this.form.b_statement,this.form.re mLen,200);' onKeyUp='textCounter(this.form.b_statement,this.form.remL en,200);'><?php echo "$row[b_statement]";?> </textarea> <br> <input readonly type=text name=remLen size=3 maxlengsth=3 value='200'> characters left</font> </form> </center></td></tr> <!-- textCounter() parameters are: field, the count field, max length --> text

<tr><td ><input type='Submit' name='Submit' value='Update' </td></tr> </table> </form>

</body>

Coding for delete_student.php

<?php $student_id=$_GET['studentid']; $con=mysql_connect('mysql13.000webhost.com','a2140952_riyas',' password123') or die(mysql_error()); mysql_select_db('a2140952_cricket'); mysql_query("delete from applicants where student_id='$student_id'") or die(mysql_error()); header("Location:view_cricket_team.php"); ?>

References :-

01 02

the JavaScript Source to validate the input field! http://javascript.internet.com Reference for this code to check the radio button! http://www.codeave.com/javascript/code.asp?u_log=7049

03

gradient background source: http://www.colorzilla.com.

Вам также может понравиться