Answer is on page 3... posted by myself...
Answer is on page 3... posted by myself...
Last edited by Rockonmetal; 07-15-2007 at 03:04 AM.
Give me a minute, Bravenet doesn't like me... i'll put it on freewebs...
The connection name would be the name you give for your MySQL database connection. Your database server (beings that you installed WAMP5) would be "localhost" (without the quotes). The username and password by default is "root" (again, no quotes) with no password. The database will be the database that you have set up using either the MySQL command line tools or using PHPMyAdmin (which I believe comes preinstalled with WAMP5).
Hope this helps.
//EDIT (after reading what's below the last image in your post): Not sure how you would do it in Dreamweaver, but if you were to make your own php script to write to files, you may want to look through these pages for any understanding on how to do so:
http://www.php.net/fopen
http://www.php.net/fwrite
http://www.php.net/file_get_contents
http://www.php.net/fclose
(and so on...)
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design
Ok the images are up... anyone willing to help me out here, let me know...
Thanks to all
ok i'll try that...
What should go in connection name?
Edit:
I just installed WAMP5 Onto my computer and I haven't found how to name my server or change the username and password...
Ok I think I might just have a way to bypass the who binding thing...
I'll put up the code i have
Last edited by thetestingsite; 07-08-2007 at 09:19 PM.
Theres the code... it wrote it into the document data.txtPHP Code:<?php
$filename = 'data.txt';
$somecontent = "Add this to the file\n";
// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {
// In our example we're opening $filename in append mode.
// The file pointer is at the bottom of the file hence
// that's where $somecontent will go when we fwrite() it.
if (!$handle = fopen($filename, 'a')) {
echo "Cannot open file ($filename)";
exit;
}
// Write $somecontent to our opened file.
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
echo "Success, wrote ($somecontent) to file ($filename)";
fclose($handle);
} else {
echo "The file $filename is not writable";
}
?>
Ok, now how do I get that to write the entire form into the document?
You would need to put the code you posted into a php document, and to write the contents of the form to the file, you will need to request the content like so:
Hope this helps.Code:<?php $filename = 'data.txt'; $formfield = $_POST['field1']; /* The above can be $_POST, $_GET, or $_REQUEST depending on the way you are submitting the form. field1 (inside the $_POST array) is the name of the field in which you are requesting the data from. the variable $formfield is just a variable. */ $somecontent = "This is a test. $formfield \r\n"; // Let's make sure the file exists and is writable first. if (is_writable($filename)) { // In our example we're opening $filename in append mode. // The file pointer is at the bottom of the file hence // that's where $somecontent will go when we fwrite() it. if (!$handle = fopen($filename, 'a')) { echo "Cannot open file ($filename)"; exit; } // Write $somecontent to our opened file. if (fwrite($handle, $somecontent) === FALSE) { echo "Cannot write to file ($filename)"; exit; } echo "Success, wrote ($somecontent) to file ($filename)"; fclose($handle); } else { echo "The file $filename is not writable"; } ?>
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design
So Field1 Is set as the Form name or the inputs?
It would be the field in the form that you want the data from. Example:
The form:
The PHP script:Code:<form action="test.php" method="POST"> <input type="text" name="testField"> <input type="submit" value="Go"> </form>
Hope this helps.Code:<?php $var = $_POST['testField']; echo $var; //echos whatever was typed into the text field named testField ?>
//EDIT: Also, the fields need to be spelled the exact same in both the form and the php script for it to work properly.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design
Sweet Thanks alot! one question though. Can I do this?
?? Or do I have to put in entirely different code for that.Code:$var = $_POST['testField' , 'testField2'];
You would have to call the field in individual statements like so:
or simply call the field like so if you are just going to use it once in the script:Code:<?php $name = $_POST['name']; $email = $_POST['email'];
Hope this helps.Code:<?php echo $_POST['name'] . " <br> " . $_POST['email']; //will display something like Name <br> Email in the source code. ?>
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design
Bookmarks