运行php文件php代码显示在网页上方时,PHP代码无法正确执行

时间:2018-06-01 04:00:13

标签: php

我试图在项目上执行一些PHP代码,但代码没有运行。

当我运行一个php文件时,php代码显示在网页上方并且php代码没有执行。

有人对正在发生的事情提出建议吗?

我无法解决此问题..提交按钮无效。请帮助我解决此问题。

StuForm.css



*

{
    padding: 0;
    margin: 0;
    border: 0;
}
body, html {
    color: #373C40;
    font-family: Verdana,Arial, Helvetica, sans-serif;
    height: 100%;
    background-color: #f0f0f0;
    margin:10px;
}
body {
    font-size: 70%;
}
p {
    padding: 7px 0 7px 0;
    font-weight: 500;
    font-size: 10pt;
}

h1 {
    font-weight:200;
    color: #888888;
    font-size:16pt;
    background: transparent url(img/h1.png) no-repeat center left;
    padding-left:33px;
    margin:7px 5px 8px 8px;
}
h4 {
    padding:1px;
    color: #ACACAC;
    font-size:11pt;
    font-weight:100;
    text-transform:unset;
}
form.profile{
    width:900px;
    margin: 20px auto 20px auto;
    height:1600px;
    background-color:#fff;
    padding:5px;
    -moz-border-radius:20px;
    -webkit-border-radius:20px;
}
form p{
    font-size: 8pt;
    clear:both;
    margin: 0;
    color:gray;
    padding:4px;
}
form.profile fieldset.row1
{
    width:450px;
    padding:5px;
     height:250px;
    float:left;
    border-top:1px solid #F5F5F5;
    border-right:1px solid #F1F1F1;
    margin-bottom:15px;
      margin-bottom:15px;
}
form.profile fieldset.row1 label{
    width:100px;
    float: left;
    text-align: left;
    margin-right: 6px;
    margin-top:2px;

}

form.profile fieldset.row3 label,
form.profile fieldset.row4 label
{
    width:160px;
    float: left;
    text-align: center;
    margin-right: 6px;
    margin-top:2px;

}
form.profile fieldset.row2
{
    border-top:1px solid #F1F1F1;
    height:250px;
    width:400px;
    padding:5px;
    float:left;
      margin-bottom:15px;
      

}
form.profile fieldset.row3
{
    border-top:1px solid #F1F1F1;
    padding:5px;
    float:left;
    margin-bottom:15px;
    width:870px;
}
form.profile fieldset.row4
{
    border-top:1px solid #F1F1F1;
    padding:5px;
    float:left;
    width:870px;
    }

form.profile fieldset.row5
{
    border-top:1px solid #F1F1F1;
    padding:5px;
    float:left;
    width:870px;
    }


form.profiler table
{

    align:center;
}

form.profile legend
{
    color: #abda0f;
    padding:2px;
    margin-left: 14px;
    font-weight:bold;
    font-size: 16px;
    font-weight:100;
}
form.profile label{
    color:#444;
    width:120px;
    float: left;
    text-align: left;
    margin-right: 6px;
    margin-top:2px;
}

form.profile input{
    width: 140px;
    color: #505050;
    float: left;
    margin-right: 5px;
}
form.profile input.long{
    width: 247px;
    color: #505050;
}

form.profile input.course{
    width: 270px;
    color: #505050;
}

form.profile input.subject{
    width: 200px;
    color: #505050;
}
form.profile input.short{
    width: 40px;
    color: #505050;
}
form.profile input[type=radio]
{
    float:left;
    width:15px;
}

form.profile input[type=image]
{
    
    width:200px;
    height: 200px;
}
form.profile label.gender{
    margin-top:-1px;
    margin-bottom:2px;
    width:34px;
    float:left;
    text-align:left;
    line-height:19px;
}
form.profile input[type=text],
form.profile input[type=date]
{
    border: 1px solid #E1E1E1;
    height: 18px;
}

form.profile textarea.extra{
    width: 247px;
    color: #505050;
    height: 100px;
    border-color: 1px solid #E1E1E1;
}
.button
{
    background: #abda0f url(img/overlay.png) repeat-x;
    padding: 8px 10px 8px;
    color: #fff;
    text-decoration: none;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
    -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
    text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
    cursor: pointer;
    float:left;
    font-size:18px;
    margin:10px;


}
form.profile input[type=text].year
{
    border: 1px solid #E1E1E1;
    height: 18px;
    width:30px;
}

form.profile select
{
    border: 1px solid #E1E1E1;
    width: 130px;
    float:left;
    margin-bottom:3px;
    color: #505050;
    margin-right:5px;
}

form.profile select.result
{
    width: 40px;
}
input:focus, select:focus{
    background-color: #efffe0;
}



**StuForm.php**

<? php

$connection = new mysqli("localhost", "root", "","student_information");

	if ($connection->connect_error) {
	    die("Connection failed: " . $connection->connect_error);
	}


	$sql = "INSERT INTO course_details (Student_ID,Admitted_Date,Academic_Year,Course,Profile_Picture)
				VALUES ('$student_id','$admitted_date','$academic_year','$course','$profile_picture');";

	$sql .= "INSERT INTO personal_details (First_Name,Middle_Name,Last_Name,DOB,Gender,NIC,Nationality,Religion,Race)
				VALUES ('$first_name','$middle_name','$last_name','$dob','$gender','$nic','$nationality','$religion','$race');";

	$sql .= "INSERT INTO contact_details (P_Add_Line1,P_Add_Line2,P_Add_Line3,City,Email,T_Add_Line1,T_Add_Line2,T_Add_Line3,stu_con_home,Stu_Con_Mobile1,Stu_Con_Mobile2,P_Con_Home,P_Con_Mobile1,P_Con_Mobile2)
				VALUES ('$p_add_line1','$p_add_line2','$p_add_line3','$city','$email','$t_add_line1','$t_add_line2','$t_add_line3','$stu_con_home','$stu_con_mobile1','$stu_con_mobile2','$p_con_home','$p_con_mobile1','$p_con_mobile2');";
				
	$sql .= "INSERT INTO academic_details (O_Admi_No,O_Year,O_Subject1,O_Grade1,O_Subject2,O_Grade2,O_Subject3,O_Grade3,O_Subject4,O_Grade4,O_Subject5,O_Grade5,O_Subject6,O_Grade6,O_Subject7,O_Grade7,O_Subject8,O_Grade8,O_Subject9,O_Grade9,A_Admi_No,A_Year,A_Subject1,A_Grade1,A_Subject2,A_Grade2,A_Subject3,A_Grade3,A_Subject4,A_Grade4,Z_Score)
				VALUES ('$o_admi_no','$o_year','$o_subject1','$o_grade1','$o_subject2','$o_grade2','$o_subject3','$o_grade3','$o_subject4','$o_grade4','$o_subject5','$o_grade5','$o_subject6','$o_grade6','$o_subject7','$o_grade7','$o_subject8','$o_grade8','$o_subject9','$o_grade9','$a_admi_no','$a_year','$a_subject1','$a_grade1','$a_subject2','$a_grade2','$a_subject3','$a_grade3','$a_subject4','$a_grade4','$z_score');";						

	$sql .= "INSERT INTO extra_curricular_activities (School_Level,Zonal_Level,District_Level,Provincial_Level,National_Level,International_Level,Current_Activities)
				VALUES ('$school_level','$zonal_level','$district_level','$provincial_level','$national_level','$international_level','$current_activities')";

	if ($connection->multi_query($sql) === TRUE) {
	    echo "Submitted Successfully";
	} else {
	    echo "Error: " .$sql."<br>". $connection->error;
	}

	$connection->close();
 	?>
  
<!DOCTYPE html>
<html >
    <head>
        <title>Student Information Form</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <link rel="stylesheet" type="text/css" href="StuForm.css"/>
    </head>
    <body>    
        <form method="post" action="StuForm.php" class="profile">
            <h1>Create Profile</h1>
            
            	<fieldset class="row1">
                	
                	<legend>Course Details</legend>

                		<table >
                			<tr >
                				<td rowspan="3">
                					<input type="image" />
                				</td>

                				<td>
                					<p>
     									<label>Student ID *</label>
                    					<input type="text" value="IM/20xx/xxx"  />
                					</p>

                				</td>

            				</tr>

                			<tr>
                				<td>
                					<p>    
                						<label>Admitted Date *</label>
                    					<input type="date" />
                					</p>

            					</td>
        					</tr>
                

                			<tr>
                				<td>
                					<p>
                    					<label>Academic Year*</label>
                    					<input type="text" />
                					</p>

            					</td>
        					</tr>

					        <tr>
					        	<td colspan="2">
					                <p>    
					                	<label>Course*</label>
					                    <input type = "text" name = "Course"  value="Bsc.in Management Information Technology" class="course"/>
					                </p>
					            </td>
					        </tr>
              		 </table>
            
            	</fieldset>
            
              	<fieldset class="row2">
                	<legend>Personal Details</legend>
                	
                	<p>
	                    <label>First Name *</label>
	                    <input type="text" class="long"/>
                	</p>

	                <p>
	                    <label>Middle Name *</label>
	                    <input type="text" class="long"/>
	                </p>

	                <p>
	                    <label>Last Name *</label>
	                    <input type="text" class="long"/>
	                </p>

	                <p>
	                    <label>Date of Birth *</label>
	                    <input type="date" />
	                </p>

	                <p>
	                    <label>Gender *</label>
	                    <input type="radio" name= "male " value="radio"/>
	                    <label class="gender">Male</label>
	                    <input type="radio" name= "female " value="radio"/>
	                    <label class="gender">Female</label>
	                </p>

	                <p>
	                    <label>NIC Number *</label>
	                    <input type="text" maxlength="10"/>
	                </p>
                
	                <p>
	                    <label>Nationality *</label>
	                    <select>
	                        <option></option>
	                        <option value="1">Sri Lankan</option>
	                    </select>
	                </p>

	                <p>
	                	
	                	<label >Religion</label>
	                    <select>
							<option value=""></option>
							<option value="Buddism">Buddism</option>
							<option value="Hindu">Hindu</option>
							<option value="Islam">Islam</option>
							<option value="Christian">Christian</option>
							<option value="Other">Other</option>  
						</select>
					</p>

					<p>

						<label >Race</label>
						<select>
						  <option value=""></option>
						  <option value="Sinhala">Sinhala</option>
						  <option value="Tamil">Hindu</option>
						  <option value="Muslim">Muslim</option>
						  <option value="Burger">Burger</option>
						  <option value="Other">Other</option>  
						</select>

	                </p>
                
            	</fieldset>
            	
            	<fieldset class="row3">
                	<legend>Contact Details</legend>
                
            			<table >
            				<tr>
            					<th><h4> Permanent Address</h4></th>
            					<th><h4> Temporary Address</h4></th>
            				</tr>
            	
            				<tr>
            					<td>
            						<p>
                    					<label>Address Line 1  </label>
                    					<input type="text" class="long"/>
                					</p>
            					</td>

            					<td>
            						<p>
                    					<label>Address Line 1  </label>
                						<input type="text" class="long"/>
                					</p>
            					</td>
            				</tr>

            				<tr>
            					<td>
            						<p>
                    					<label>Address Line 2</label>
                    					<input type="text" class="long"/>
                					</p>
            					</td>
            		
            					<td>
            						<p>
                    					<label>Address Line 2</label>
                    					<input type="text" class="long"/>
                					</p>
            					</td>

            				</tr>

               				<tr>
            					<td>
            						<p>
                    					<label>Address Line 3</label>
                    					<input type="text" class="long"/>
                					</p>
            					</td>
            		
            					<td>
            						<p>
                    					<label>Address Line 3</label>
                    					<input type="text" class="long"/>
                					</p>
            					</td>

            				</tr>

                			<tr>
                				<td colspan="2">
                					<p>
										<label >City</label>
										<input type = "text" class="long"  />

									</p>
								</td>
							</tr>

							<tr>
								<td colspan="2">

									<p>

										<label >Email Address</label>
										<input type = "text" class="long" value="abc@gmail.com" />

									</p>
								</td>
							</tr>

			
							<tr>
								<th><h4>Student's Contact Number</h4></th>
								<th><h4>Parent's Contact Number</h4></th>
							</tr>

							<tr>
								<td>

									<p>
										<label >Home</label>
										<input type = "text" maxlength="10" />
									</p>

								</td>

								<td>

									<p>
										<label >Home</label>
										<input type = "text" maxlength="10" />
									</p>

								</td>

							</tr>

							<tr>
								<td>
									<p>
										<label >Mobile 1</label>
										<input type = "text" maxlength="10"  />
									</p>
								</td>

								<td>
									<p>
										<label >Mobile 1</label>
										<input type = "text" maxlength="10"  />
									</p>
								</td>

							</tr>

							<tr>
								<td>
									<p>
										<label >Mobile 2</label>
										<input type = "text" maxlength="10"  />
									</p>
								</td>

								<td>
									<p>
										<label >Mobile 2</label>
										<input type = "text" maxlength="10"  />
									</p>
								</td>

							</tr>

						</table>
                
            	</fieldset>
           		
           		<fieldset class="row4">
                	<legend>Academic Details</legend>

            			<table >
			            	<tr>
			            		<th><h4>O/L Results</h4></th>
			            		<th><h4>A/L Results</h4></th>
			            	</tr>

			            	<tr>
			            		<td>
			            			<p>

										<input type = "text" name = "Admition Number" placeholder = "Admition Number"/>
										<input type = "text" name = "Year" placeholder = "Year" />

									</p>
								</td>

								<td>
			            			<p>

										<input type = "text" name = "Admition Number" placeholder = "Admition Number"/>
										<input type = "text" name = "Year" placeholder = "Year" />

									</p>
								</td>

							</tr>


							<tr>
								<td>
									
									<p>
										<label >Subject 1</label>
										<input type = "text" name = "Mathematics"  value="Mathematics" class="subject"/>
										<select class="result">
							  				<option value=""></option>
							  				<option value="A">A</option>
							  				<option value="B">B</option>
							  				<option value="C">C</option>
							  				<option value="S">S</option>
							  				<option value="F">F</option>  
										</select>

									</p>
								</td>

								<td>


									<p>
										<label >Subject 1</label>

										<input type = "text" name = "Subject 1"  class="subject" />
										<select class="result">
										  <option value=""></option>
										  <option value="A">A</option>
										  <option value="B">B</option>
										  <option value="C">C</option>
										  <option value="S">S</option>
										  <option value="F">F</option>  
										</select>
									</p>

								</td>

							</tr>

							<tr>
								<td>
									
									<p>
										<label >Subject 2</label>
										<input type = "text" name = "Science"  value="Science" class="subject"/>
										<select class="result">
							  				<option value=""></option>
							  				<option value="A">A</option>
							  				<option value="B">B</option>
							  				<option value="C">C</option>
							  				<option value="S">S</option>
							  				<option value="F">F</option>  
										</select>


									</p>
								</td>
								
								<td>
									<p>
										<label >Subject 2</label>
						                <input type = "text" name = "Subject 2" class="subject" />
						                   <select class="result">
											  <option value=""></option>
											  <option value="A">A</option>
											  <option value="B">B</option>
											  <option value="C">C</option>
											  <option value="S">S</option>
											  <option value="F">F</option>  
											</select>
						            </p>

						        </td>

						    </tr>
						            
						            

						    <tr>
						        <td>
						        				
						        	<p>
						        		<label >Subject 3</label>
										<input type = "text" name = "Sinhala"  value="Sinhala" class="subject"/>
										<select class="result">
							  				<option value=""></option>
							  				<option value="A">A</option>
							  				<option value="B">B</option>
							  				<option value="C">C</option>
							  				<option value="S">S</option>
							  				<option value="F">F</option>  
										</select>
									</p>
						        </td>

						        <td>
						            <p>    
						            	<label >Subject 3</label>
										<input type = "text" name = "Subject 3" class="subject"  />
										<select class="result">
											<option value=""></option>
											<option value="A">A</option>
											<option value="B">B</option>
											<option value="C">C</option>
											<option value="S">S</option>
											<option value="F">F</option>  
										</select>
									</p>

								</td>
				        	</tr>



					        <tr>

					        	<td>
					        		<p>
					        			<label >Subject 4</label>
										<input type = "text" name = "English"  value="English" class="subject"/>
										<select class="result">
							  				<option value=""></option>
							  				<option value="A">A</option>
							  				<option value="B">B</option>
							  				<option value="C">C</option>
							  				<option value="S">S</option>
							  				<option value="F">F</option>  
										</select>
									</p>

					        	</td>

					        	<td>

									<p>
										<label >Subject 4</label>
										<input type = "text" name = "General English" value="General English" class="subject"/>
									    <select class="result">
										  <option value=""></option>
										  <option value="A">A</option>
										  <option value="B">B</option>
										  <option value="C">C</option>
										  <option value="S">S</option>
										  <option value="F">F</option>  
										</select>
									</p>

								</td>
							</tr>

							<tr>
								<td>
									<p>
										<label >Subject 5</label>
										<input type = "text" name = "Religion"  value="Religion" class="subject"/>
										<select class="result">
							  				<option value=""></option>
							  				<option value="A">A</option>
							  				<option value="B">B</option>
							  				<option value="C">C</option>
							  				<option value="S">S</option>
							  				<option value="F">F</option>  
										</select>
									</p>


								</td>

								<td>
									<p>
										<label >Z-Score</label>
										<input type = "text" name = "Z-Score"  />
									</p>

								</td>
							</tr>

							<tr>
								<td colspan="2">

									<p>
										<label >Subject 6</label>
										<input type = "text" name = "History"  value="History" class="subject"/>
										<select class="result">
							  				<option value=""></option>
							  				<option value="A">A</option>
							  				<option value="B">B</option>
							  				<option value="C">C</option>
							  				<option value="S">S</option>
							  				<option value="F">F</option>  
										</select>
									</p>

								</td>
							</tr>


							<tr>
								<td colspan="2">

									<p>
										<label >Subject 7</label>
										<input type = "text" name = "Group Subject 1" placeholder = "Group Subject 1" class="subject" />
										<select class="result">
							  				<option value=""></option>
							  				<option value="A">A</option>
							  				<option value="B">B</option>
							  				<option value="C">C</option>
							  				<option value="S">S</option>
							  				<option value="F">F</option>  
										</select>
									</p>

								</td>
							</tr>


							<tr>
								<td colspan="2">

									<p>
										<label >Subject 8</label>
										<input type = "text" name = "Group Subject 2" placeholder = "Group Subject 2" class="subject" />
										<select class="result">
							  				<option value=""></option>
							  				<option value="A">A</option>
							  				<option value="B">B</option>
							  				<option value="C">C</option>
							  				<option value="S">S</option>
							  				<option value="F">F</option>  
										</select>
									</p>
								</td>
							</tr>

							<tr>
								<td colspan="2">

									<p>
										<label >Subject 9</label>
								 		<input type = "text" name = "Group Subject 3" placeholder = "Group Subject 3"  class="subject"/>
								 		<select class="result">
							  				<option value=""></option>
							  				<option value="A">A</option>
							  				<option value="B">B</option>
							  				<option value="C">C</option>
							  				<option value="S">S</option>
							  				<option value="F">F</option>  
										</select>
								 	</p>

								</td>
							</tr>

		 				</table>

            	</fieldset>

            	</fieldset>
            	
            	<fieldset class="row5">
                	
                	<legend>Extra Curricular Activities</legend>
                
                

		                <table >
		                	<tr>
		                		<th colspan="2"><h4>Extra Curricular Activities</h4></th>
		                	</tr>

		                	<tr>
		                		<td>
		                			<p>

										<label for="School Level">School Level:</label>
										<textarea name="School Level" placeholder="School Level" class="extra"></textarea>
									</p>
								</td>
							
								<td>
									<p>

										<label for="Zonal Level">Zonal Level:</label>
										<textarea name="Zonal Level" placeholder="Zonal Level" class="extra"></textarea>

									</p>
								</td>
							</tr>

							<tr>
		                		<td>
		                			<p>

										<label for="Provincial Level">Provincial Level:</label>
										<textarea name="Provincial Level" placeholder="Provincial Level" class="extra"></textarea>
									</p>
								</td>
							
								<td>
									<p>

										<label for="National Level">National Level:</label>
										<textarea name="National Level" placeholder="National Level" class="extra"></textarea>

									</p>
								</td>
							</tr>

							<tr>
		                		<td colspan="2">
		                			<p>

										<label for="International Level">International Level:</label>
										<textarea name="International Level" placeholder="International Level" class="extra"></textarea>

									</p>
								</td>
							</tr>

							<tr>
		                		<td colspan="2">
		                			<p>

										<h4>Current Activities</h4>
										<textarea name="Current Activities" placeholder="Current Activities" class="extra"></textarea>
									</p>
								</td>
							</tr>

						</table>

        		</fieldset>

            <div><button class="button">Submit &raquo;</button></div>
        </form>
    </body>
</html>
&#13;
&#13;
&#13;

0 个答案:

没有答案