Jump to content

Can anyone tell me why this is not working?


Chubichan

Recommended Posts

I have here a PHP page that pulls from an external stylesheet. The form right now, works as a table, but not as a div formated table.

 

Here is the code that DOES NOT work:

 

<!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>MinglePost | Completely Free Dating</title>

 

<link rel="stylesheet" type="text/css" href="stylesheets_minglepost/style_main.css">

 

</head>

 

<body>

<div id="container">

    <a href="index.html"><div id="logo"></div></a>

    <p>It really couldn't be simpler.</p>

<?php

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

                    {

                    include 'config.php';

                    include 'opendb.php';

                   

                    $username = $_POST['username'];

                    $email = $_POST['email'];

                    $pass = $_POST['pass'];

                   

                    $query = "INSERT INTO registration (username, email, pass) VALUES ('$username', '$email', '$pass')";

                    mysql_query($query) or die('Error, insert query failed');

                   

                    include 'closedb.php';

                    echo "Thank you for registering $username. Your password is $pass. There will be an email dispatched to $email with your login details for your records!";

                    }

                    else

                    {

                    ?>

                    <form meathod="post">

                <div><label for="username">Username:</label><input name="username" type="text" id="username" size="30" /></div>

                <div><label for="email">Email:</label><input name="email" type="text" id="email" size="30" /></div>

              <div><label for="pass">Password:</label><input name="pass" type="password" id="pass" size="30" /></div>

                <div class="actions"><input type="submit" input name="add" value="Submit" id="add" class="submit"/></div>

                </form>

                    <?php

                    }

                    ?>

<ol id="help_bar">

                <li class="first"><a href="register.html">Register</a></li>

                <li class="first"><a href="advertise.html">Advertise</a></li>

                <li class="last"><a href="#">Policy</a></li>

        </ol>

</div>

       

</div>

</body>

</html>

 

As for the supporting php documents "config" "opendb" and "closedb," I am just using them to connect and disconnect from the database. They work fine when I am using a table based form, so I know they are working as they should. I am mainly concerned with the form here as that is really the only thing that I have changed and that is what kills it. Thanks for any help. Sorry I am such a noob, but I have searched the internet high and low, bought two books, and still can't figure out what I going on. This is my last resort. Any help would be great. Cheers!

 

Link to comment
Share on other sites

Mate,

here is the error: <form meathod="post"> it's supposed to be <form method="post" action="<?php echo $_SERVER['PHP_SELF]; ?>">

 

or make the action to the name of this file

 

hint: please try to use any IDE(Integrated Development Environment) ex: Zend Studio is brilliant

Link to comment
Share on other sites

Got it working. Did some research on what bloody said and took it a bit further by removing my php entirely and placing it into a separate file then calling it with

<form method="post" action="reg.php">

.

 

Worked like a charm. Also noticed some code I had in there too that needed to be removed. Thanks mate!

You are all the best!! Cheers!

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.