Jump to content

Improve the look of php mysql website


Parkie02

Recommended Posts

Can somebody maybe tell me is there an easier way to create the look of the website the html part. For example here is my code

<html>
	<head>
		<title> 
			Registration Form
		</title>
	</head>
	
<body>
<form method='post' action='registration.php'>
	<table width='400' border='5' align='center'>
	<tr>
		<td align='center' colspan='5'><h1>Registration Form</h1></td>
	</tr>

	<tr>
		<td>Email:</td>
		<td><input type='text' name='email' /></td>
	</tr>
	
	<tr>
		<td>Password:</td>
		<td><input type='password' name='password' /></td>
	</tr>
	
	<tr>
		<td>Company Name:</td>
		<td><input type='text' name='company' /></td>
	</tr>
	
	<tr>
		<td>Registration Number:</td>
		<td><input type='text' name='reg_nr' /></td>
	</tr>
	
	<tr>
		<td>Telephone Number:</td>
		<td><input type='text' name='telephone' /></td>
	</tr>
	
	<tr>
		<td>Address:</td>
	</tr>
	
	<tr>
		<td>Street:</td>
		<td><input type='text' name='street' /></td>
	</tr>
	
	<tr>
		<td>Suburb:</td>
		<td><input type='text' name='suburb' /></td>
	</tr>
	
	<tr>
		<td>City:</td>
		<td><input type='text' name='city' /></td>
	</tr>
	
	<tr>
		<td>Province:</td>
		<td><input type='text' name='province' /></td>
	</tr>
	
	<tr>
		<td>Postal Code:</td>
		<td><input type='text' name='postalcode' /></td>
	</tr>
	
	<tr>
		<td>Contact Person:</td>
		<td><input type='text' name='contact_person' /></td>
	</tr>
	
	<tr>
		<td>Contact Person Telephone Number:</td>
		<td><input type='text' name='contact_person_tel' /></td>
	</tr>
	
	<tr>
		<td colspan='5' align='center'><input type='submit' name='submit' value='Sign Up' /></td>
	</tr>
	
	
	</table>
</form>
<center><b>Already Registered</b><br><a href= 'login.php'>Login Here</a></center> 
</body>
</html>
<?php
mysql_connect("localhost","root","");
mysql_select_db("whodidntpay");

	if(isset($_POST['submit']))
	{
		$com_password = $_POST['password'];
		$com_email = $_POST['email'];
		$com_companyname = $_POST['company'];
		$com_registration = $_POST['reg_nr'];
		$com_telephone = $_POST['telephone'];
		$com_street = $_POST['street'];
		$com_suburb = $_POST['suburb'];
		$com_city = $_POST['city'];
		$com_province = $_POST['province'];
		$com_postalcode = $_POST['postalcode'];
		$com_contactperson = $_POST['contact_person'];
		$com_contactpersontel = $_POST['contact_person_tel'];
			
		if($com_email=='')
		{
			echo "<script>alert('Please Enter Email')</script>";
			exit();
		}
		
		if($com_password=='')
		{
			echo "<script>alert('Please Enter Password')</script>";
			exit();
		}
		
		if($com_companyname=='')
		{
			echo "<script>alert('Please Enter Company Name')</script>";
			exit();
		}
		
		if($com_registration=='')
		{
			echo "<script>alert('Please Enter Registration Number')</script>";
			exit();
		}
		
		if($com_telephone=='')
		{
			echo "<script>alert('Please Enter Telephone Number')</script>";
			exit();
		}
		
		if($com_street=='')
		{
			echo "<script>alert('Please Enter Street Name')</script>";
			exit();
		}
		
		if($com_suburb=='')
		{
			echo "<script>alert('Please Enter Suburb Name')</script>";
			exit();
		}
		
		if($com_city=='')
		{
			echo "<script>alert('Please Enter City')</script>";
			exit();
		}
		
		if($com_province=='')
		{
			echo "<script>alert('Please Enter Province')</script>";
			exit();
		}
		
		if($com_postalcode=='')
		{
			echo "<script>alert('Please Enter Postel Code')</script>";
			exit();
		}
		
		if($com_contactperson=='')
		{
			echo "<script>alert('Please Enter Contact Person Name')</script>";
			exit();
		}
		
		if($com_contactpersontel=='')
		{
			echo "<script>alert('Please Enter Contact Person Telphone Nr')</script>";
			exit();
		}
		
		$check_email = "select * from complainant where email='$com_email'";
		$run = mysql_query($check_email);
		if(mysql_num_rows($run)>0)
		{
			echo"<script>alert('Email $com_email already exists, please use another email')</script>";
			exit();
		}
		
		$query = "insert into complainant(email,password,company_name,registration_nr,telephone_nr,street,suburb,city,province,postal_code,contact_person,contact_person_tel) 
		values ('$com_email','$com_password','$com_companyname','$com_registration','$com_telephone','$com_street','$com_suburb','$com_city','$com_province','$com_postalcode','$com_contactperson','$com_contactpersontel')";
		if (mysql_query($query))
		{
			echo "<script>alert('Registration Successful')</script>";
			echo "<script>window.open('welcome.php','_self')</script>";
		}
		
	}	

?>

Is there any way to create the html part with software and then just add the php part. Because doing it like this it is difficult for me to create a webpage that looks good.

Link to comment
Share on other sites

The PHP and HTML is quite seperated in the code you've posted.

 

If you want the page to 'look nicer' then learn CSS and control the look and feel of the page that way.

 

You can use a template if you wish, and then just copy your PHP code into it. You would just need to make sure that your form elements are still included to communicated with the PHP script.

 

Otherwise, employ a designer. ;D

 

Also, put your PHP in the <head></head> of your document, it's much clearer and will cause you less problems in the long run if you try and echo data from PHP into the body of the HTML page.

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.