Hi all,
I am trying to work on an existing script. There is a feature/button to EDIT info in the database. I need to add a feature/button to ADD a file to the database, but then in the add <div> I need to write code to direct a user to the EDIT <div> to complete the form...Also I need to create a DELETE within the EDIT.
At the top of my script (or anywhere?) don't I also need to create a new variable for this ADD button( !?) with 'INSERT INTO' ?
This is the existing EDIT button and form:
<div id="editbox" <? if($_SESSION['mode']!="editor" || $_GET['p_id']==""){ ?> style="display:none;"<? } ?>>
<div style="text-align:left;"><a href="?">CLOSE</a></div>
<?=$msg?>
<form method="post" action="?mode=editor&table=properties&p_id=<?=$_GET['p_id']?>">
<?
$sql_o = "SELECT * FROM pit_company WHERE p_id = ".$_GET['p_id'];
$result_o = mysql_query($sql_o); //echo $sql_o;
while ($row_o = mysql_fetch_assoc($result_o)) {
?>
<input type="hidden" name="p_id" value="<?=$row_o['p_id']?>" />
ID : <?=$_GET['p_id'];?><br />
Name : <input name="p_name" value="<?=$row_o['p_name']?>" /><br />
Address 1 : <input name="p_address1" value="<?=$row_o['p_address1']?>" /><br />
Is this right for starters?:
<div id="addbox" <? if($_REQUEST['mode']!="add"){ ?> style="display:none;"<? } ?>>
<form method="post" action="?mode=editor&table=properties&action=addlocation">
Address 1 : <input name="p_address1" value="<?=$row_o['p_address1']?>" /><br />
</form>
</div>
I don't know if the 'Address 1...' part is necessary - At what point do I direct user to 'editbox', and how?
Any suggestions are greatly appreciated 🙂