I am makeing a admin page in php/sqlite.
in my index.php you can select a table with md5 id in header for items.
this is a example from my index.php after selected table "beer"
"http://localhost/admin/index2.php?tableName=Beer"
i can edit/update but can't insert a item.
what i would like is, when i have select the table called "beer" or "drinks"
add the item to the selected table. i would like something like:
"http://localhost/admin/add.php?tableName=Beer"
how can i make a add.php where it remembers the selected table?
is it replace location with javascript or $_get[tableName] PHP?
the current add.php dosent remember the selected table.
Newbie advice strongly needed[Solved]
Moderator: General Moderators
Newbie advice strongly needed[Solved]
Last edited by nexus6 on Mon Jul 11, 2005 5:11 pm, edited 1 time in total.
i have heard the i should use the $_GET command
but i still can't get it to work...
this is my add.php code:
where am i going wrong???
but i still can't get it to work...
this is my add.php code:
Code: Select all
<?php
function errHandler($errno, $errstr, $errfile, $errline) {
echo "Error: <b>[$errno at line $errline] $errstr</b><br />\n";
}
if (isset($_GET["tableName"])) {
$table = sqlite_escape_string($_GET["tableName"]);
set_error_handler("errHandler");
}?>
<HTML>
<HEAD>
<TITLE>Johnbull.dk</TITLE>
<script>
function goto(id, table) {
location.replace('show.php?' +id+ '&' +table);
}
</SCRIPT>
<LINK type="text/css" href="styles/main.css" rel="stylesheet" />
</HEAD>
<BODY>
<H1>Johnbull.dk - Opret ny</H1>
<FORM method="POST" action="actions/insert2.php">
<TABLE cellpadding="0" cellspacing="0">
<TR>
<TD>Navn</TD>
<TD><INPUT NAME="title" SIZE="53" VALUE=""/></TD>
</TR>
<TR>
<TD>info dk</TD>
<TD><textarea name="info_dk" ROWS=8 COLS=40></textarea></TD>
</TR>
<TR>
<TD>info uk</TD>
<TD><textarea name="info_uk" ROWS=8 COLS=40></textarea></TD>
</TR>
<TR>
<TD>Land</TD>
<TD><INPUT NAME="land" SIZE="53" VALUE=""/></TD>
</TR>
<TR>
<TD>Vol</TD>
<TD><INPUT NAME="vol" SIZE="53" Value=""/></TD>
</TR>
<TR>
<TD>Størrelse</TD>
<TD><INPUT NAME="size" SIZE="53" VALUE=""/></TD>
</TR>
<TR>
<TD>Pris</TD>
<TD><INPUT NAME="price" SIZE="53" VALUE=""/></TD>
</TR>
</TABLE>
<INPUT TYPE="submit" name="Save" value="Gem" />
</FORM>
</BODY>
</HTML>where am i going wrong???