uitlijnen form

Status
Niet open voor verdere reacties.

computercrash

Gebruiker
Lid geworden
10 jun 2007
Berichten
57
ik wil dit uitlijnen zodat de textboxen precies naast elkaar staan maar mij lukt het niet echt

http://www.kokkie.exofire.net/register.php

HTML:
<center>
<form method=\"POST\">
Inlognaam: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"username\"><br />
Wachtwoord: <input type=\"password\" size=\"15\" maxlength=\"25\" name=\"pass\"><br />
Bevestig wachtwoord: <input type=\"password\" size=\"15\" maxlength=\"25\" name=\"cpass\"><br />
Email: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"emai1\"><br />
<input name=\"register\" type=\"submit\" value=\"Registreer\">
</form>
</center>
 
Misschien is het handig als je eens wat HTML- en PHP-tutorials doorwerkt, want dit is wel heel basic.

Gebruik tabellen.

Google > 'html tables'.
 
computercrash,
Probeer de code hieronder eens!
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<style type="text/css">
<!--
.login {
	left: 52px;
	background-position: center;
	padding-left: 10px;
}
.table {
	margin-right: auto;
	margin-left: auto;
}
-->
</style>
</head>

<body>




<form method=\"POST\">
<table class="table" width="250" border="0" cellspacing="0" cellpadding="5">
  <tr>
    <td width="200">Inlognaam:</td>
    <td><input class="login" type="text" size="15" maxlength="25" name="username" /></td>
  </tr>
  <tr>
    <td>Wachtwoord:</td>
    <td><input class="login" type="password" size="15" maxlength="25" name="pass" /></td>
  </tr>
  <tr>
    <td>Bevestig wachtwoord: </td>
    <td><input class="login" type="password" size="15" maxlength="25" name="cpass" /></td>
  </tr>
  <tr>
    <td>Email:</td>
    <td><input  class="login"type="text" size="15" maxlength="25" name="emai1" /></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td align="right"><input class="login" name="register" type="submit" value="Registreer" /></td>
  </tr>
</table>
</form>

</body>
</html>
 
Dan ligt dat aan jouw PHP, want aan de code van DeFietser mankeert niets.
 
PHP:
<?php

ob_start();
// allows you to use cookies
include("config.php");
//gets the config page
if ($_POST[register]) {
// the above line checks to see if the html form has been submitted
$username = $_POST[username];
$password = $_POST[pass];
$cpassword = $_POST[cpass];
$email = $_POST[emai1];
//the above lines set variables with the user submitted information
if($username==NULL|$password==NULL|$cpassword==NULL|$email==NULL) {
//checks to make sure no fields were left blank
echo "Je hebt niet alle velden ingevuld!";
}else{
//none were left blank!  We continue...
if($password != $cpassword) {
// the passwords are not the same!  
echo "De wachtwoorden komen niet overeen!";
}else{
// the passwords are the same!  we continue...
$password = md5($password);
// encrypts the password
$checkname = mysql_query("SELECT username FROM users WHERE username='$username'");
$checkname= mysql_num_rows($checkname);
$checkemail = mysql_query("SELECT email FROM users WHERE email='$email'");
$checkemail = mysql_num_rows($checkemail);
if ($checkemail>0|$checkname>0) {
// oops...someone has already registered with that username or email!
echo "Jouw loginnaam is al in gebruik, probeer een ander!";
}else{
// noone is using that email or username!  We continue...
$username = htmlspecialchars($username);
$password = htmlspecialchars($password);
$email = htmlspecialchars($email);
// the above lines make it so that there is no html in the user submitted information.
//Everything seems good, lets insert.
$query = mysql_query("INSERT INTO users (username, password, email) VALUES('$username','$password','$email')");
// inserts the information into the database.
echo "Gefeliciteert, je bent nu geregistreerd!";
}
}
}
}
else
{
// the form has not been submitted...so now we display it.
echo ("

<form method=\"POST\">
Inlognaam: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"username\" ><br />
Wachtwoord: <input type=\"password\" size=\"15\" maxlength=\"25\" name=\"pass\"><br />
Bevestig wachtwoord: <input type=\"password\" size=\"15\" maxlength=\"25\" name=\"cpass\"><br />
Email: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"emai1\"><br />
<input name=\"register\" type=\"submit\" value=\"Registreer\">
</form>

");
}
?>

kan iemand dan dit aanpassen want mij lukt het niet echt. onderaan staat de loginform
 
Er staat 1 foutje in de code van DeFietser.

Verander dit :

Code:
<form method=\"POST\">

Naar dit :

Code:
<form method="POST">

Probeer eens of dit helpt...
 
nee, dat maakt helemaal niks uit

ik heb nu nog een beetje geprobeert maar het lukt echt niet!

in html zitten er geen fouten in maar zodra ik het in php zet lukt het niet
 
Laatst bewerkt:
Als je de html in je php bestand zet moet je met forward slaches werken ( \ ). Dit om de html quotes juist te laten interpreteren.

Als ik er geen vergeten ben zou het zo moeten werken :

Code:
<?php

ob_start();
// allows you to use cookies
include("config.php");
//gets the config page
if ($_POST[register]) {
// the above line checks to see if the html form has been submitted
$username = $_POST[username];
$password = $_POST[pass];
$cpassword = $_POST[cpass];
$email = $_POST[emai1];
//the above lines set variables with the user submitted information
if($username==NULL|$password==NULL|$cpassword==NULL|$email==NULL) {
//checks to make sure no fields were left blank
echo "Je hebt niet alle velden ingevuld!";
}else{
//none were left blank!  We continue...
if($password != $cpassword) {
// the passwords are not the same!  
echo "De wachtwoorden komen niet overeen!";
}else{
// the passwords are the same!  we continue...
$password = md5($password);
// encrypts the password
$checkname = mysql_query("SELECT username FROM users WHERE username='$username'");
$checkname= mysql_num_rows($checkname);
$checkemail = mysql_query("SELECT email FROM users WHERE email='$email'");
$checkemail = mysql_num_rows($checkemail);
if ($checkemail>0|$checkname>0) {
// oops...someone has already registered with that username or email!
echo "Jouw loginnaam is al in gebruik, probeer een ander!";
}else{
// noone is using that email or username!  We continue...
$username = htmlspecialchars($username);
$password = htmlspecialchars($password);
$email = htmlspecialchars($email);
// the above lines make it so that there is no html in the user submitted information.
//Everything seems good, lets insert.
$query = mysql_query("INSERT INTO users (username, password, email) VALUES('$username','$password','$email')");
// inserts the information into the database.
echo "Gefeliciteert, je bent nu geregistreerd!";
}
}
}
}
else
{
// the form has not been submitted...so now we display it.
echo ("

<form method=\"POST\">
<table class=\"table\" width=\"250\" border=\"0\" cellspacing=\"0\" cellpadding=\"5\">
  <tr>
    <td width=\"200\">Inlognaam:</td>
    <td><input class=\"login\" type=\"text\" size=\"15\" maxlength=\"25\" name=\"username\" /></td>
  </tr>
  <tr>
    <td>Wachtwoord:</td>
    <td><input class=\"login\" type=\"password\" size=\"15\" maxlength=\"25\" name=\"pass\" /></td>
  </tr>
  <tr>
    <td>Bevestig wachtwoord: </td>
    <td><input class=\"login\" type=\"password\" size=\"15\" maxlength=\"25\" name=\"cpass\" /></td>
  </tr>
  <tr>
    <td>Email:</td>
    <td><input  class=\"login\" type=\"text\" size=\"15\" maxlength=\"25\" name=\"emai1\" /></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td align=\"right\"><input class=\"login\" name=\"register\" type=\"submit\" value=\"Registreer\" /></td>
  </tr>
</table>
</form>

");
}
?>
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan