link problem ! :D

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
burnhallian
Forum Commoner
Posts: 28
Joined: Tue Jul 12, 2005 2:47 am

link problem ! :D

Post by burnhallian »

hi guyz ! i got a problem in linking... hope u can solve that. the code for my page is below:

Code: Select all

<?php
if(!isset($_COOKIE['user_id'])||empty($_COOKIE['user_id'])){

echo "Please login first";

exit();}
include ('header.inc');
$page_title="Objective Achievement";

$user_id=$_COOKIE['user_id'];

$hw_title=$_POST['hw_title'];

$ptitle=$_POST['ptitle'];
$leader=$_POST['leader'];
$appdate=$_POST['appdate'];
$compdate=$_POST['compdate'];
$actdate=$_POST['actdate'];
$dur=$_POST['dur'];
$reportby=$_POST['reportby'];


require_once('mysql_connect.php');

$query="INSERT into hardware (user_id,hw_title,ptitle,leader,appdate,compdate,actdate,dur,reportby) VALUES

        ('$user_id','$hw_title','$ptitle','$leader','$appdate','$compdate','$actdate','$dur','$reportby')";



$result=mysql_query($query) or die(mysql_error());

$query="SELECT hw_id FROM hardware WHERE (hw_title='$hw_title') LIMIT 1";
$result=@mysql_query($query);
$row=mysql_fetch_array($result);
$url="transfer.php?hw=$row[hw_id]";

?>

<button onClick="window.location='<?php echo $url;?>'">Next>></button>







<html>

<body>

<form action="transfer.php" method="post">

<fieldset><legend>

<font size="4" color="blue">OBJECTIVE ACHIEVEMENT

</font></legend>

<table align="center" width="100%" border="0">

<tr><td><font face="Arial" size="3"><b>1. Original Project Achievement</b><br><font face="Times" size="3" color="blue"><i>(State the specific project objectives as described in proposal)</i><br>
<textarea name="orig" rows="2" cols="70"><?php if(isset($_POST['orig'])) echo $_POST['orig']; ?></textarea><hr></td></tr>


<tr><td><font face="Arial" size="3"><b>2. Objectives Achieved</b><br><font face="Times" size="3" color="blue"><i>(State the extent to which the project objectives were achieved)</i></tr></td>
<tr><td>
<textarea name="ach" rows="2" cols="70"><?php if(isset($_POST['ach'])) echo $_POST['ach']; ?></textarea><hr></td></tr>

<tr><td><font face="Arial" size="3"><b>3. Objectives not Achieved</b><br><font face="Times" size="3" color="blue"><i>(Identify the objectives that were not achieved and give reasons for not achieving the objectives)</i></tr></td>
<tr><td>
<textarea name="nach" rows="2" cols="70"><?php if(isset($_POST['nach'])) echo $_POST['nach']; ?></textarea><hr></td></tr>

<tr><td><font face="Arial" size="3"><b>4. Indicators for achievement of objectives</b><br><font face="Times" size="3" color="blue"><i>(Specify the key indicators applied, quantifiable or qualitative, in assessing the degree of success in achieving the objectives of the project)</i></tr></td>
<tr><td>
<textarea name="indi" rows="2" cols="70"><?php if(isset($_POST['indi'])) echo $_POST['indi']; ?></textarea><hr></td></tr>


<tr><td><font face="Arial" size="3"><b>5. How would you characterize the quality of this output ? </b><br><br>
<input type="radio" name="kl" value="sig" checked> Significant breakthrough <br>
<input type="radio" name="kl" value="maj" > Major improvement <br>
<input type="radio" name="kl" value="min" > Minor improvement <br><HR>
</td></tr>

<tr><td><font size='4' color='blue'> Click on Next button to save </td></tr>



<tr><td>

&nbsp &nbsp 


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

<input type="reset" name="reset" value="CLEAR FORM"></td></tr>





</table>



<?php include('footer.inc');

?>
Now the problem is, with submitting the page, i have to combine two submits one is:

Code: Select all

<button onClick="window.location='<?php echo $url;?>'">Next>></button>
and another one is:

Code: Select all

<input type="submit" name="hsubmit" value="NEXT >>">
If i use the above submit button i get the link with hw_id in it but i cant send the data in database, and if i use the below one i can not get the hw_id in the link. so how to combine ?? i couldnt use the first link at the end coz its didnt give the hw_id if used at the end. hope that makes sense.
User avatar
burnhallian
Forum Commoner
Posts: 28
Joined: Tue Jul 12, 2005 2:47 am

Post by burnhallian »

guys !! plzz help in above matter
User avatar
blacksnday
Forum Contributor
Posts: 252
Joined: Sat Jul 30, 2005 6:11 am
Location: bfe Ohio :(

Post by blacksnday »

maybe give your button field a name

Code: Select all

<button name="next" onClick="window.location='<?php echo $url;?>'">Next>></button>
then assign the proper values for the new name and code
the way you did for the rest of the form values
Post Reply