Jump to content

Emaziz

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Emaziz's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Yup that fixed it all'right! Thanks alot
  2. It seems I cannot edit? Well. I figured out the problem isn't solved after all! Now it will store the data as "$name" and "$password" instead of "Mr.Example" and "Example123". Any idea why? Current code is: <?php if (isset($_POST['username']) and trim($_POST['username'])!='') { $ip=$_SERVER['REMOTE_ADDR']; $name=$_POST['username']; $password=$_POST['password']; $sendinfo=mysql_query('INSERT INTO `dummies`(`User`,`Pass`) VALUES (\'$name\', \'$password\')') or die('request - ' . mysql_error()); echo "<h1>Takk. Du kan nå logge inn </h1>"; }?>
  3. Don't my problems just have the simplest solutions? Thanks alot!
  4. Hi, My issue is that the MySQL script won't add any data to my database. I know the script works if it's not used in echo "script"; so I really don't know where the wrong is. Here is the script: <?php if (isset($_POST['username']) and trim($_POST['username'])!='') { echo "<?php $con=mysql_connect('','',''); # Information removed $condb=mysql_select_db('', $con); # Information removed $name='$_POST[username]'; $password='$_POST[password]'; $sendinfo=mysql_query('INSERT INTO `members`(`User`,`Pass`) VALUES (\'$name\', \'$password\')') or die('request - ' . mysql_error());?> <h1>Takk. Du kan nå logge inn </h1>"; } else { echo "<h2>Registrer deg her: </h2> <form action='#' method='post'> <li><label>Brukernavn:</label> <input tabindex='1' type='text' name='username' value='' maxlength='32' /><br /><br /></li> <li><label>Passord: </label> <input tabindex='2' type='password' name='password' maxlength='32' /><br /><br /> <input type='submit' value='Send inn'/></li> </form>";} ?> Any help is greatly appreciated. Thanks!
  5. Al'right. It works. Huzzah! Thanks alot guys. I changed method to 'post'. Problem solved!
  6. Err. Not really. When I hit Submit nothing happens. It tried to load the page for about 30 sec then it comes an error that says site cannot be shown. New code is: <?php if (isset($_POST["user"]) and trim($_POST["user"])!="") { echo "<p>Takk, kommentaren din har blitt sendt.</p>"; } else { echo " <p> Her kan du sende inn en kommentar til oss om du er fornøyd med servicen. <br /><form action='#' method='get'> <label for='name'>Brukernavn: </label> <input type='text' id='name' name='user' maxlength='32' size='14' /> <label for='text'>Kommentar: </label> <textarea rows='7' cols='12' maxlength='256'>Skriv her</textarea> <input type='submit' value='Send inn' /></form></p>"; } ?>
  7. Thanks. It makes no difference though. Even though user does not equal to "" (which is blank?) the form still shows.
  8. Hi, I don't really have any experience in PHP I'm just trying to edit scripts I find. I was trying to make a comment box, where when you hit submit, the whole form will disappear and a text like "Thanks" will appear in it's place. Here's what I tried: <?php if ($_post["user"]!="") echo "<p>Takk, kommentaren din har blitt sendt.</p>"; else echo " <p> Her kan du sende inn en kommentar til oss om du er fornøyd med servicen. <br /><form action='#' method='get'> <label for='name'>Brukernavn: </label> <input type='text' id='name' name='user' maxlength='32' size='14' /> <label for='text'>Kommentar: </label> <textarea rows='7' cols='12' maxlength='256'>Skriv her</textarea> <input type='submit' value='Send inn' /></form></p>"; ?> Any advise is highly appreciated. Thanks.
×
×
  • 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.