How do you add PHP code to 000webhost html code block?

I have a web page and inserted html code in an area of a registration page. I need to display message from php process on this page. i.e. Error message fro php post process.

When I add the php code, it just resolves as text on the web page. It is not recognizing it as php code.

Thanks
Dennis

@dbreitkreutz save the registration page as “index.php” instead of “index.html”

I had saved the index file as index.php. I am using website builder and a prebuilt template. The actual file for the registration page appears to be generated as 6.php in the Zyro directory.

I add php code in the html section via webite builder but it does not render as php… just html.

Thanks for your help
Dennis

Or else you can give the link for 6.php in your html section.
So to register one can click on the link and the link will redirect to 6.php.

My page is working fine and registers correctly… I have a form in this page and it executes a POST in a different php file.

So this is all working… What I want it the Messages for the posting php to be displayed on the registration page. I believe the 6.php files is creating when I save from website builder. I need to php error coding entered in the website builder template, stored and executed in the 6.php file.

I hope this helps explain my problem. I am sure it is something simple I am missing, I just cannot semm to figure it out.

Thank you.
Dennis

You should upload the php code file into your hosting account.

Then you could iframe the php file into your html page

Attached are some screen shots and hopefully a better explaining of my issue. I rewrote the text on the image here as well.

index.php has been created and is in public_html directory.
Form in website builder (believe this creates 6.php in Zyro directory… this is not my php file)

See first image

Click “register” and Form action calls pwregister.php which include error.php (my files I created in public_html directory)
This file checks data and does database queries \ inserts etc…
If tha data validate error occurs the current error.php file will send error message to separate web page
.
See 2nd image

When I try to move error.php to htlm code block in website builder file above it does not work.
I tried added as raw php code…
I tried adding as iframe src and I get this…

See 3rd image

Any help would be greatly appreciated.
Dennis

Thank you akhilkumar332 and Infinity!

After working with your suggestions and grasping the concept of needing to put ALL the code (form and php) in a single php file and then using this file in the iframe call, I finally have this working.

Thank you again for the help.
Dennis

Hi - i have the same issue:

i have a form where someone enters first name last name, and an ID, then clicks on a button to call a jsp (verify_person.jsp) but i just get the text of hte verify_person.jsp displayed instead of the action. Snippet of calling and called code are below:

<form action="verify_person.jsp" method="post">
			<fieldset style="width: 300px">
				<legend></legend>
				<table>
					<tr>
						<td>First Name</td>
						<td><input type="text" name="first_name" required="required" /></td>
					</tr>
					<tr>
						<td>Last Name</td>
						<td><input type="text" name="last_name" required="required" /></td>
					</tr>
					<tr>
						<td>Student ID</td>
						<td><input type="text" name="student_id" required="required" /></td>
					</tr>
					<tr>
						<td><input type="submit" value="Check" /></td>
					</tr>
				</table>
			</fieldset>
			</form>
		</div>

starting 10 lines of verify_person.jsp (raw text of this file is displayed upon clicking chck button from above)

<%@ page import=“java.sql.*”%>
<%
//get the informations from the form and initially, set the student as nonexistant
String fname=request.getParameter(“first_name”);
String lname=request.getParameter(“last_name”);
String sid=request.getParameter(“student_id”);
boolean authenticated=false;
boolean exists=false;
int length = String.valueOf(sid).length();

//if everything is good
if(fname!=null && fname != “” && lname !=null && lname != “” && sid !=null && sid != “”) {
//if (length == 10) {
//process the info
out.println("\n Entering fname section where fname= “+fname+” and last name = “+lname+” and student id = " +sid);
//System.out.println(“fname=”+fname);

	try {
		//out.println("in Try block\n");
	
		Class.forName("com.mysql.jdbc.Driver").newInstance();
		Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/id1870407_my_database_name_here","id1870407_my_user_name_here","my_db_password_here");

I believe java is not available on 000webhost, 000webhost offers php support.
If you need java on your website, consider using a VPS