hexdsl Posted March 25, 2006 Share Posted March 25, 2006 ok, i am experimenting with PHP to make a basic text RPG, i am quite savvy with other programing languages but sadly not PHP.the code is a basic setup script for the site, it should simply pass the INPUTBOX entrys to a FlatfileDB handler for writing to a file called ADMIN.DAT (just a txt file really) anyway all it does it pass the NAME of the inbox's tp teh DB handler, i am hopling someone can point out where i am going wrongCODE: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]<?php function goninja($adminusr, $adminpswd, $adminemail, $adminloca, $gamename, $gameurl) { //Define Table names, for Usability define('adminusr', 0); define('adminpswd', 1); define('adminemail', 2); define('adminloca', 3); define('gamename', 4); define('gameurl', 5); //Start DataBase Server require_once('flatfile.php'); //Create New Database Within data directory $db = new Flatfile(); $db->datadir = 'data/'; //now lets setup first entry $newpost[adminusr] = $adminusr; $newpost[adminpswd] = $adminpswd; $newpost[adminemail] = $adminemail; $newpost[adminloca] = $adminloca; $newpost[gamename] = $gamename; $newpost[gameurl] = $gameurl; $newId = $db->insertWithAutoId('admin.dat', POST_ID, $newpost); }?></head><body class="thestyle"> <h1 align="center">THE ASCENSION</h1> <p align="center" class="thestyle">SOME TEXT HERE</p> <p align="left" class="thestyle">Well here we go!</p> <form action="<?php goninja(adminusr, adminpswd, adminemail, adminloca, gamename, gameurl); ?>" method="post" name="form1"> <p> </p> <table width="535" border="0" align="center"> <tr> <td width="195"><span class="style4">Admin User Name </span></td> <td width="330"><input name="adminusr" type="text" id="adminusr" size="50" maxlength="50"></td> </tr> <tr> <td><span class="style4">Admin Password</span></td> <td><input name="adminpswd" type="text" id="adminpswd" size="50" maxlength="50"></td> </tr> <tr> <td><span class="style4">Admin E-mail address</span></td> <td><input name="adminemail" type="text" id="adminemail" size="50" maxlength="50"></td> </tr> <tr> <td><span class="style4">Admin Geo-Location</span></td> <td><input name="adminloca" type="text" id="adminloca" size="50" maxlength="50"></td> </tr> <tr> <td><span class="style4">Game Name </span></td> <td><input name="gamename" type="text" id="gamename" size="50" maxlength="50"></td> </tr> <tr> <td height="34"><span class="style4">Game URL </span></td> <td><input name="gameurl" type="text" id="gameurl" size="50" maxlength="50"></td> </tr> </table> <p align="center"> <input type="submit" name="Submit" value="Submit">[/quote] Quote Link to comment Share on other sites More sharing options...
Gast Posted March 25, 2006 Share Posted March 25, 2006 I think its the way you handle the form. Just set the form action to the same page that you are or and then add this at the top:[code]<?phpif(isset($_POST['Submit'])) { goninja($_POST['adminusr'], $_POST['adminpswd'], $_POST['adminemail'], $_POST['adminloca'], $_POST['gamename'], $_POST['gameurl']); }?>[/code]That should work. I would also recommend changing:[code]$newpost[adminusr][/code]To this:[code]$newpost['adminusr'][/code]For all of the $newpost array. Quote Link to comment Share on other sites More sharing options...
hexdsl Posted March 26, 2006 Author Share Posted March 26, 2006 thanks, will TRY that now... hope it works Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.