Jump to content


A little varible problem

  • Please log in to reply
2 replies to this topic

#1 hexdsl

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 25 March 2006 - 12:46 PM

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 wrong

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
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

//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);


<body class="thestyle">

<h1 align="center">THE ASCENSION
<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">
<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>
<td><span class="style4">Admin Password</span></td>
<td><input name="adminpswd" type="text" id="adminpswd" size="50" maxlength="50"></td>
<td><span class="style4">Admin E-mail address</span></td>
<td><input name="adminemail" type="text" id="adminemail" size="50" maxlength="50"></td>
<td><span class="style4">Admin Geo-Location</span></td>
<td><input name="adminloca" type="text" id="adminloca" size="50" maxlength="50"></td>
<td><span class="style4">Game Name </span></td>
<td><input name="gamename" type="text" id="gamename" size="50" maxlength="50"></td>
<td height="34"><span class="style4">Game URL </span></td>
<td><input name="gameurl" type="text" id="gameurl" size="50" maxlength="50"></td>
<p align="center">
<input type="submit" name="Submit" value="Submit">[/quote]

#2 Gast

  • Members
  • PipPipPip
  • Advanced Member
  • 131 posts
  • LocationSouth East England

Posted 25 March 2006 - 06:16 PM

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:

if(isset($_POST['Submit'])) {
    goninja($_POST['adminusr'], $_POST['adminpswd'], $_POST['adminemail'], $_POST['adminloca'], $_POST['gamename'], $_POST['gameurl']); 

That should work. I would also recommend changing:


To this:


For all of the $newpost array.
OS and Internet Specs:
Windows XP (with SP2), 1680x1050, PHP 4, MySQL 3, Internet Explorer 6 &7 /FireFox 2.0/Opera 9.2

Simple Introduction to AJAX and XMLHttpRequest
Creating Live Data with AJAX Making a Google Suggest like application

#3 hexdsl

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 26 March 2006 - 06:52 PM

thanks, will TRY that now... hope it works

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users