Jump to content

_DarkLink_

Members
  • Posts

    45
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Male
  • Location
    Hmmm....

_DarkLink_'s Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. You may also use a meta-refresh. if(isset($_POST['submit'])) { //check inputs vs db if ($check) { echo "<meta http-equiv=\"refresh\" content=\"0;url=". $_SERVER['SERVER_NAME']."/include/process_renew.php\">"; } else { echo "<font color='red'>Username or Password did not match.</font> <br /><br />"; } }
  2. Meh, I was trying to find that "Thank You" button somewhere. But anyway, will do what you said.
  3. Oh my, it worked! I can't believe it, I have been wasting too much time on this little part of my project. I don't know how I may thank you enough for this. [EDIT]How do I thank someone?[EDIT] Thank you for putting your time in this and helping me.
  4. Hey is what the array contains: array(1) { [0]=> string(16) "QWERTY\r\nAZERTY" } It does not seem to be separated into two arrays. Thank you, more help is appreciated.
  5. Hello, I would really appreciate if you guys would have a look at this piece of code. <?php if(isset($_POST['add'])) { $self = $_SERVER['PHP_SELF']; //the $self variable equals this file $ipaddress = ("$_SERVER[REMOTE_ADDR]"); //the $ipaddress var equals users IP //connect $connect = mysql_connect($host,$username,$password) or die('<p class="error">Unable to connect to the database server at this time.</p>'); mysql_select_db($database,$connect) or die('<p class="error">Unable to connect to the database at this time.</p>'); //fetch data $data = htmlspecialchars($_POST['list']); $comment = mysql_real_escape_string($_POST['comment']); $data_lines = explode( "\r\n", $data ); $comment_lines = explode("\r\n", $comment); for($i=0;$i<count($data_lines);$i++) { $data_fields = explode( ",", $data_lines[$i]); $time = time(); $queryb = "INSERT INTO coords SET tag='{$data_fields[0]}', guild='{$data_fields[1]}', name='{$data_fields[2]}', base='{$data_fields[3]}', econ='{$data_fields[5]}', maxecon='{$data_fields[6]}', location='{$data_fields[4]}', comment='{$comment_lines[$i]}', ipaddress='$ipaddress' , date='$time';"; // if it succeeds, display message if (mysql_query($queryb)) { echo('<p class="success">Successful posting of ['.$data_fields[3].']!</p>'); } else { echo('<p class="error">Error could not post ['.$data_fields[3].'] to database!</p>'); } }//end for loop }//end if $_POST['add'] statement ?> As you can see, it gets data received from a form's submission and explodes them into lines. For $data, it explodes it again for each comma. It then inserts everything for each comma, in a new column and for each line, on a new row. Now for $comment, it should be inserting it on a new row for each line, which isn't doing it, it just inserts the whole comment into one single row. Been looking and testing at it for a few days now. The comment column is a varchar of 100 of length. So basically, it does everything i need it to do except inserting $comment on a new row for every line. Any help is appreciated. Thank you in advance.
  6. What he means is that you have to include session.php before you can use $session->logged_in. which means on every page that you would like to make it a member only page, you will have to put this before anything: <?php include("your/folder/to/session.php"); ?>
  7. Oh and since this is a PHP forum, I'll make a little PHP validation script too. <form name="testform" action="myphpfile.php" method="POST" onsubmit="return validate();"> <input type="checkbox" name="terms" value="on"> I accept the <a href="http://www.example.com/terms.html">Term and Conditions</a>. <input type="submit" value="Register" name="submit"> </form> PHP processing script: <?php if ($_POST['submit']) { if {$_POST['terms'] =="on") { //your piece of code that will execute if terms are checked. } else{ echo "Please accept the Terms and Contions first."; header("Refresh: 5; url=registrationform.html");//if it isn't checked, send back to the registration form in five seconds. } } ?> Hope it helps.
  8. First, as an example, to make a check box and a submit button in a form: <form name="testform" action="myphpfile.php" method="POST" onsubmit="return validate();"> <input type="checkbox" name="terms"> I accept the <a href="http://www.example.com/terms.html">Term and Conditions</a>. <input type="submit" value="Register" name="submit"> </form> Alright, so to validate if the check box is checked, there are two ways, you either use PHP to validate it AFTER the form is sent and send the user back to the form if it is not checked, Or simply use JavaScript to check it if it is checked BEFORE the form is sent, an example would be: <script type="text/javascript"> function validate(){ if (document.testform.terms.checked == false) { alert ( "Please accept the terms before continuing." ); return false; } else { return true; } } </script> So basically the JavaScript checks the form, on submit if the check box is checked, it it's not, send a little pop up message saying to check it and the form is not submitted. If it is checked, then let the form submit. Hope it helps.
  9. Hello, Is it just me or are you ending the else statement as soon as you started it? <?php if($_POST['submit']) { $db = mysql_connect($dbhost, $dbuser, $dbpassword); mysql_select_db($dbdatabase, $db); $sql = "INSERT INTO comments(blog_id, dateposted, name, comment) VALUES(". $validentry . ", NOW(),'" . $_POST['name'] . "','" . $_POST['comment'] . "');"; mysql_query($sql); header("Location: http://" . $HTTP_HOST . $SCRIPT_NAME . "?id=" . $validentry); } else { }//Here... ?> Try putting the ending curly bracket at the end of everything, after the closing HTML tags for example. Such as here: <?php require("footer.php"); }//Close the else statement. ?> Hope it helps.
  10. Hmm, does my code really look like it has no errors? ...
  11. No problem, I'm glad to know that you finally got it working. Don't forget to mark the topic solved by clicking on the "Topic Solved" button at the bottom left side of this page.
  12. You just need to click on that little "Topic Solved" button at the bottom left side of this page.
  13. Hmm, I'm almost out of ideas. =/ But anyway, can you tell me what does that piece of JavaScript exactly do? I can see that "translator.js" judging by it's name, it translates the word to Greek, but how exactly does it do it? I can also see an "onkeyup" event in the Greek text areas.
  14. Well, depending on the logic of things, you should put the connection before the code, since you have to be connected to the database before fetching data from it.
×
×
  • 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.