View Single Post
Old 11-19-2010, 07:18 PM   #1 (permalink)
kphigh
The Visitor
 
Join Date: Nov 2010
Posts: 2
Thanks: 1
kphigh is on a distinguished road
Default Help with php form

Hi,

I am extremely new to PHP. I have a form which is used to add/update data a mysql database. One of the fields is called "Approved' and I use a yes/no radio button to update the field. Is there a way to only allow certain team members see and or uddate the Approved field? I capture the username from the browser cookie.

Here is the code I use for the form:

<html>
<head>
<title>My Page</title>
</head>
<body>
<align = center><h2>SureIt Entry/Update Form</h2></align>
<?php
// set database server access variables:
$host = "";
$user = "";
$pass = "";
$db = "";

$tag=$_POST['tag'];
$developer=$_POST['developer'];
$application=$_POST['application'];
$username=$_COOKIE["InfoMgrWT"];

// open connection
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");

// select database
mysql_select_db($db) or die ("Unable to select database!");

// create query
$query = "SELECT * FROM revo.sureit where tag = '".$tag."' and developer ='".$developer."' and application = '".$application."'";
//print $query;
//$query= "SELECT * from sureit";
// execute query
$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
$row = mysql_fetch_row($result);

if($row[0])
{
echo "<form name='ProdMove_1' action='sureit_update.php' method='POST'>";
echo "<div align='left'>";
}
else
{
echo "<form name='ProdMove_1' action='sureit_insert.php' method='POST'>";
echo "<div align='left'>";
}
echo "Tag<br>";

echo "<input type='text' name='tag' value='".$tag."'><BR><br>";

echo "Developer<br>";
echo "<input type='text' name='developer' value='".$developer."'><BR><br>";

echo "Application<br>";
echo "<input type='text' name='application' value='".$application."'><BR><br>";

echo "Description of Code change<br>";
echo '<textarea cols=60 rows=15 wrap="soft" name="descofchange">'.$row[3].'</textarea><BR><br>';

echo "Details<br>";
echo '<textarea cols=60 rows=15 wrap= "soft" name="details">'.$row[14].'</textarea><BR><br>';

echo "Description of Database Change<br>";
echo '<textarea cols=60 rows=15 wrap="hard" name="descofdbchange">'.$row[4].'</textarea><BR><br>';


echo "Front End Changes<br>";
echo '<textarea cols=60 rows=15 wrap="soft" name="frontendchanges">'.$row[9].'</textarea><BR><br>';

echo "Move Instructions<br>";
echo '<textarea cols=60 rows=15 wrap="soft" name="moveinst">'.$row[11].'</textarea><BR><br>';


echo "Post Move Validation<br>";
echo '<textarea cols=60 rows=15 wrap = "soft" name="postmovevalidate">'.$row[12].'</textarea><BR><br>';
echo "Move Validated<br>";
if ($row[15] == 'Y')
{
echo "<input type='radio' name='movevalidated' value='Y' checked >Y<br>";
echo "<input type='radio' name='movevalidated' value='N' >N<br>";
}
else
{
echo "<input type='radio' name='movevalidated' value='Y' >Y<br>";
echo "<input type='radio' name='movevalidated' value='N' checked >N<br><br><br>";
}
'<br><br>';
echo "Approved<br>";

if ($row[6] == 'Y')
{
echo "<input type='radio' name='approved' value='Y' checked >Y<br>";
echo "<input type='radio' name='approved' value='N' >N<br>";
}

else
{
echo "<input type='radio' name='approved' value='Y' >Y<br>";
echo "<input type='radio' name='approved' value='N' checked >N<br><br>";
}


echo "Cancelled<br>";
if ($row[13] == 'Y')
{
echo "<input type='radio' name='cancelled' value='Y' checked >Y<br>";
echo "<input type='radio' name='cancelled' value='N' >N<br>";
}
else
{
echo "<input type='radio' name='cancelled' value='Y' >Y<br>";
echo "<input type='radio' name='cancelled' value='N' checked >N<br>";
}
?>
<br>
<input type = "submit" value = "Submit">
<br><br>
<a href="http://revolab0.uswin.ad.vzwcorp.com/sureit_query.html">Back</a>
</form>
</body>
</html>


Thanks
kevin
kphigh is offline  
Reply With Quote