Jump to content

Recommended Posts

Hello All

 

I am stuck and puzzled now. I have one table that I query and it displays the results. However when I click submit the information does not automatically display and has to refresh (F5) before it shows.

 

Here is the code I created. Please dont shoot me down in flames for this I have only really been doing this a couple of weeks and still learning.

 

<?php

 

require('assets/inc/auth.inc.php');

 

dbOpen();

chkAuth($userType);

 

$memID = $_GET['id'];

$query = mysql_query("SELECT * FROM tracked_vehicles WHERE id = $memID") or die(mysql_error());

 

 

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Fetchitnow - User Management</title>

<link type="text/css" rel="stylesheet" href="assets/css/main.css" />

 

 

</head>

<body>

 

<?php include("assets/inc/header.inc.php"); ?>

<div id="content">

<?php include("assets/inc/returnJourneys.inc.php"); ?>

<h1>User Management</h1>

<script language="javascript" type="text/javascript">

function checkscript()

{

var subCase = confirm("Are you sure you want to delete this vehicle?");

if (subCase== true){

return true;

}else{

return false;

}

}

</script>

  <?

if(mysql_num_rows($query) > 0){

?>

 

<table width="100%" border="0" align="center" cellpadding="6" cellspacing="1" class="style1">

 

  <tr>

        <td width="10%" bgcolor="#EBEBEB"><p><strong> User #ID</strong></p></td>

    <td width="33%" bgcolor="#EBEBEB"><p><strong> Tracking Code</strong></p></td>

    <td width="45%" bgcolor="#EBEBEB"><p><strong> Van Type</strong></p></td>

    <td width="12%" bgcolor="#EBEBEB"><p><strong> Delete van</strong></p></td>

  </tr>

 

<?

while($row = mysql_fetch_array($query)){

 

?>

  <tr>

    <td bgcolor="#F5F5F5"><p class="style1"> <?=$row["id"];?></p></td>

    <td bgcolor="#F5F5F5"><p class="style1"> <?=$row["locate"];?></p></td>

    <td bgcolor="#F5F5F5"><p class="style1"> <?=$row["vantype"];?></p></td>

    <td bgcolor="#F5F5F5"><p class="style1"><a href="admin-del-vehicle.php" onclick="return checkscript();">Delete</a></p></td></p></td>

  </tr>

 

<?

}

?>

</table>

<?

} else{

dbClose();

?>

<p>There are  no users</p>

<?

}

 

?>

<p>Add another vehicle to your fleet.</p>

 

<?

chkAuth($userType);

dbOpen();

$id=$_POST['id'];

$locate=$_POST['locate'];

$van=$_POST['vantype'];

$query = mysql_query("SELECT * FROM tracked_vehicles WHERE id = $memID") or die(mysql_error());

$therow = mysql_fetch_array($query);

$querys = "INSERT INTO tracked_vehicles VALUES ('$id','$locate','$van')";

mysql_query($querys) or die(mysql_error());

 

dbClose();

 

?>

 

<form action="membertracking.php?id=<?=$memID?>" method="post">

 

<table width="100%" border="0" align="center" cellpadding="6" cellspacing="1" class="style1">

 

  <tr>

    <td width="10%" bgcolor="#EBEBEB"><p><strong> User #ID</strong></p></td>

    <td width="33%" bgcolor="#EBEBEB"><p><strong> Tracking Code</strong></p></td>

    <td width="45%" bgcolor="#EBEBEB"><p><strong> Van Type</strong></p></td>

    <td width="12%" bgcolor="#EBEBEB"><p><strong> Delete van</strong></p></td>

  </tr>

 

 

  <tr>

 

    <td bgcolor="#F5F5F5"><p class="style1"><input name="id" type="text" id="id" value="<?=$therow['id']?>"></p></td>

    <td bgcolor="#F5F5F5"><p class="style1"><input name="locate" type="text" id="locate" value="<?=$therow['locate']?>"></p></td>

    <td bgcolor="#F5F5F5"><p class="style1"><select name="vantype" class="genTxt" id="vantype">

      <option value="NA" selected>-----</option>

  <option value="Motorcycle">Motorcycle</option>

  <option value="Small Van">Small Van</option>

  <option value="Medium Van">Medium Van</option>

  <option value="Large Van">Large Van</option>

  <option value="7.5t">7.5t</option>

  <option value="other">Other</option>

    </select></p></td>

    <td bgcolor="#F5F5F5"><p class="style1"></p></td>

  </tr>

 

  <tr>

 

    <td><p>

      <input type="submit" name="submit" value="submit">

    </p>      </td>

 

    <td> </td>

  </tr>

 

</table>

 

</div>

<?php include("assets/inc/footer.inc.php"); ?>

</body>

</html>

 

Any ideas what I am doing wrong.  :shrug:

 

 

Perhaps describe your problem in a little more detail. Which query do you mean when you say 'i query and it displays the results'? What's supposed to happen when you click submit, which query is then called? In what way should the results 'automatically display'? Your problem is very vague with a big block of code.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.