• Welcome to Valhalla Legends Archive.
 
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - ChroniX

#1
Don't you mean

<?
  if(!isset($_POST['text']))
  {
    print "<form action='' method'post'>"; // changed this line
    print "<input type='text' name='text'>";
    print "<input type='submit'>";
    print "</form>";
  }
  else
  {
    $text = mysql_escape_string($_POST['text']);
    $dbconn = mysql_connect("localhost");
    mysql_query("INSERT INTO `table` (`field1`) VALUES ('$text')", $dbconn);
    mysql_close($dbconn);

    print "Updated if there weren't any errors";
  }
}


Heh, may be wrong, probably am.
#2
Web Development / Re: Ekk.. fopen/fwrite problem
April 17, 2008, 05:59 PM
I'm not saying your wrong, but I should have stated my intentions before hand. I wanted to do something like this with it.

<?php

$var = echo $_SERVER['PHP_SELF'];

?>

<form action="<?php $var; ?>" method="post">

...etc.

Orrrr... I see, you were right. I would have to echo the variable anyhow =/ sorry lol
#3
Web Development / Re: Ekk.. fopen/fwrite problem
April 16, 2008, 05:21 PM
Ah, fixed that problem.

Now, I have another question, and instead of making yet another thread, I'll just post it in this one.

Can you store global variables in variables, like so:

<?php

$var = echo $_SERVER['PHP_SELF']

?>
#4
Web Development / Ekk.. fopen/fwrite problem
April 14, 2008, 06:49 PM
Well, to start things out, here is my code being used:

<?php$file = fopen("/mps/projects/project_" . $_POST['projectnumber'] .".php", "w");echo fwrite($file, " * deleted whats to be written since it's not needed right now, and to save space * ");fclose($file);?>



The problem I'm having is that the rest of the script up until this point runs fine, but when it's suppose to execute the fopen/fwrite functions it doesn't do so. Also, just to experiment, I went to fopen("/mps/projects/project_" . $_POST... etc. and changed the fopen url to the root directory... looking something like this: fopen("test.php", "w"); echo fwrite($file, " * content * ");... pretty much just taking away all the subdirectories so that the file is created/written to in the base directory, and it works just as i want it to when I take away the extra folders (/mps/projects/). Does anyone see something I've done wrong? I'm still new with PHP but I'm sure it's not a syntax error since all I'm doing is taking away those two directories and it works just fine... I could be wrong.

Any and all help/suggestions are very much appreciated!
#5
Hah, yeah. It's no longer on the car... long story.
#6
Yes, I am using DHCP, and no, I can't contact my router through my Linux box.
#7
2000 323i BMW

15????k miles



#8
After installing Red Hat Enterprise Linux, I am unable to connect to the internet. I have installed this OS in the past, about two years ago, and had not one problem connecting to any website. So does anyone have advice that may get me online with Linux? May this be a possible router issue? I have searched google and the only close result to mine I found were people having a problem connecting to the internet with Linux after a reboot, but mine simply wont start period after a fresh install. As always, any advice and/or suggestions are welcome and appreciated.

Added * Should this have been posted in 'Computer Support Issues'?
#9
Well I am using PHP to write my scripts.  As for my previous statement, I'm just wondering if this can be done with HTML and PHP.
#10
Any suggestions as to how this can be done?  I can't seem to find anything on google, or anywhere on the web for that matter, about using an HTML form to update a record in a MySQL table.

Just wondering if anyone knows of a tutorial for this.  I have found other ways to update records, but with other web languages I have yet to learn.
#11
Web Development / Re: header() error
March 15, 2008, 09:15 PM
Ah alright, I understand now.  Well thank you for the help, and that brief tutorial. :D
#12
Web Development / Re: header() error
March 15, 2008, 08:38 PM
Ah, your a genius, thank you!  Just for the record, and to make this a learning experience so I can't just say I bummed the answer without learning anything, where does the second if statement come into play, why was it required?
#13
Web Development / Re: header() error
March 15, 2008, 08:14 PM
But how do I resolve my problem, the script works just fine until I add in the else statement.
#14
Web Development / Re: header() error
March 15, 2008, 07:31 PM
So I can put it after the variable and before echo, then it should execute with no problem?

Alright, well that worked, but now I'm having another problem and need a push in the right direction.  The script works out exactly as I want it to until I add the else statement telling it to redirect too login.php if the password is incorrect.  After adding the else statement, and refreshing register_login.php, the page automatically redirects to login.php without warning. ???  Here is my code.

<?php$password = "halo122188";if (isset($_POST['password']) == $password){header("Location: register.php");}else{header("Location: login.php");}echo '<form name="register_login" action"'.$_SERVER['PHP_SELF'].'" method="post"><input type="password" name="password"><input type="submit" name="submit" value="Authenticate"></form>';?>
#15
Web Development / header() error
March 15, 2008, 07:11 PM
When I run the following script in my browser, I get this error: "Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\register_login.php:8 ) in C:\Program Files\Apache Group\Apache2\htdocs\register_login.php on line 14"

<?php$password = "*";echo '<form name="register_login" action"'.$_SERVER['PHP_SELF'].'" method="post"><input type="password" name="password"><input type="submit" name="submit" value="Authenticate"></form>';if (isset($_POST['password']) && $_POST['password'] == $password){header("Location: register.php");}?>


How do I fix this? I don't understand why it's sending the header before the if statement is even executed...