A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: PHP/MySQL/HTML submit form AAAH!

  1. #1
    Wait- what now? tidenburg's Avatar
    Join Date
    Dec 2005
    Posts
    1,471

    PHP/MySQL/HTML submit form AAAH!

    Im really annoyed now.
    I cant figure it out heres my code:
    PHP Code:
    <?php
    require("database.php");
    mysql_connect($DBhost,$DBuser,$DBpass) or die("unable to connect");
    @
    mysql_select_db($DBName) or die( "Unable to select database");
    $query "SELECT * FROM userlist";
    $result mysql_query($query);
    $nummysql_num_rows($result);
    mysql_close();
    echo 
    "<b><center>Userlist</center></b><br><br>";

    $i=0;
    while (
    $i $num) {

    $username=mysql_result($result,$i,"username");
    $ID=mysql_result($result,$i,"ID");
    $email=mysql_result($result,$i,"email");

    echo 
    "<b>username: ".$username."</b><br>User #:".$ID."<br> E-Mail: ".$email."<hr><br>";

    $i++;
    }
    $senddetails "INSERT INTO userlist VALUES ($username,$password,"",$email)"
    send mysql_query($senddetails)
    $validate "$username = $_POST['username'];
    $password = $_POST['password'];
    $password2 = $_POST['password2'];
    $email = $_POST['email'];
    if(
    $password != "" && $password == $password2){
    echo(
    $send);
    }
    else 
    {
    echo("
    passwords did not match!");
    }"
    ?>
    <form name="form1" method="post" action="<?php
    echo $validate;
      
    ?> 
     ">
      <label>Username
      <input type="text" name="username">
      </label>
      <p>
        <label>Password
        <input type="password" name="password">
        </label>
    </p>
      <p>
        <label>Retype Password
        <input type="password" name="password2">
        </label>
    </p>
      <p>
        <label>E-Mail
        <input type="text" name="email">
        </label>
    </p>
      <p>
        <label>Register Me!
        <input type="submit" name="Submit" value="Submit">
        </label>
    </p>
    </form>
    [/CODE]
    I get the error:
    "<?php
    echo $validate;
    ?>
    " is not valid value for the "action" attribute in any of the currently active versions. See the above warnings for more details.[HTML 4.0]
    Any help would be REALLY aprreciated.
    "I'd only told them the truth. Was that so selfish? Our integrity sells for so little, but it is all we really have. It is the very last inch of us, but within that inch, we are free."

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    13,039
    Hi,

    a form action should be the url of the processing script
    Further, at first glance it seems that your script inserts something into the db when called with data (ok) but also when used to just show the form (bad)

    Musicman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center