Jump to content

[SOLVED] button frenzy


herghost

Recommended Posts

Hi All,

 

I have this:

 

		<?php
session_start();

include('../include/dbconnect.php');

$id=$_GET['id'];
$sql="SELECT * FROM forum_question WHERE id='$id'";
$result=mysql_query($sql) or die ("oh dear   " .mysql_error()) ;
while($rows=mysql_fetch_array($result))
															{?>

<h1> 		<?php echo $rows['title'];?>   </h1>

		<table>
		<tr>
		<th>System Info: </th><td>Operating System: <?php echo $rows['os'] ;?>,<br />
			Amount of Ram: <?php echo $rows['ram'] ;?>,<br />
			Harddrive Type &amp Size: <?php echo $rows['harddrive'] ;?>, <br />
		Graphics Card: <?php echo $rows['graphics'] ;?></td>
		</tr>

            <tr>
		<th>Topic: </th><td> <?php echo $rows['title'] ;?> </td>
		</tr>

            <tr>
		<th>Posted By: </th><td> <?php echo $rows['username'] ;?> </td>
		</tr>
            
		<tr>
		<th>Posted On: </th><td> <?php echo $rows['datetime'] ;?> </td>
		</tr>

		<tr>
		<th>Description: </th><td> <?php echo $rows['detail'];?> </td>
		</tr>

															<?php }?>



		<tr>
		<th>Download DxDIAG:</th>

			<?php $query = "SELECT u_id, name FROM upload WHERE post_no = '$id'";
			$result = mysql_query($query) or die('Error, query failed');
			if(mysql_num_rows($result) == 0)
				{
				echo "No DxDIAG Exists <br>";
				}
			else
				{
				while(list($u_id, $name) = mysql_fetch_array($result))

				?>
			<td><a href="forum/download.php?id=<?php echo $id;?>">Download</a></td><br>
			</table>


					<?php
						$sql2="SELECT * 
						FROM forum_answer 
						WHERE question_id='$id'";
						$result2=mysql_query($sql2);
						while($rows=mysql_fetch_array($result2))
							{
					?>
									<table>
                                       <hr>
                                       <h3>Reply Number<?php echo $rows['a_id'] ;?></h3>
									<tr>
									<th1>Posted By: </th1><td><?php echo $rows['a_username'] ;?></td>
									</tr>
                                        
                                        <tr>
                                        <th1>Posted On: </th1><td><?php echo $rows['a_datetime'] ;?></td>
                                        </tr>
                                        
									<tr>
                                        <th1><?php echo $rows['a_username'];?>'s Reply:</th1><td> <?php echo $rows['a_answer']; ?></td>
                                        </tr>
                                        <tr>		
									</tr>
									</table>
                                        <?php
											$query = "SELECT *
											FROM forum_question";
											$result = mysql_query($query, $conn) or die(mysql_error($conn));
											$row = mysql_fetch_array($result);
											extract($row);
											mysql_free_result($result);

											if ($username == $_SESSION['username'])
											{
												?>
                                                   <form method="post" action="forums/is_solved.php">
                                                    <input type="button" class="button" value="This Fixed It" />
                                                    <?php 
											}
												?>

						<?php
							}

							$sql3="SELECT view 
							FROM forum_question 
							WHERE id='$id'";
							$result3=mysql_query($sql3);
							$rows=mysql_fetch_array($result3);
							$view=$rows['view'];

							// if have no counter value set counter = 1
							if(empty($view))
								{
							$view=1;
							$sql4="INSERT INTO forum_question(view)
							VALUES('$view') 
							WHERE id='$id'";
							$result4=mysql_query($sql4);
								}

								// count more value
								$addview=$view+1;
								$sql5="UPDATE forum_question
								SET view='$addview' 
								WHERE id='$id'";
								$result5=mysql_query($sql5);

				}

?> 
  



					<form method="post" action="forum/add_answer.php?id=<?php echo $id ; ?>">			
                        <label><?php echo $_SESSION['username']; ?>'s Reply</label>
					<textarea rows="5" cols="5" name="answer" id="answer"></textarea>
					<input name="id" type="hidden" value="<?php echo $id ;?>" />
					<input class="button" type="submit" />		
					</form>	
                        
                        <table>
                <tr>
			<th><a href="javascript:ajaxpage('forum/solutions.php','main');">Back</a></th>
			</tr>
			</table>

 

it is basically a forum with the original post, and then the replys echo'd out in a table with a 'this fixed it' button. My problem is, when a new reply is posted and the submit query button is clicked, instead of posting to add_answer.php it is using is_solved.php from the 'this fixed it' button. I am stumped, I didnt even know this was possible!

 

How is it fixed?

 

Cheers

Link to comment
Share on other sites

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.