passing variable from a href to pop up box through php -
after click on href, ll pop out form , trying pass variable pop form. in while loop.
while($row = mysql_fetch_array($result)) { $id=$row['file_id']; echo '<span class=right><a href="#edit_form?id='.$id.'">[edit]</a> }
this pop form code
<a href="#x" class="overlay" id="edit_form"></a> <?php $con=mysql_connect("localhost","root",""); mysql_select_db("isiti"); if (mysqli_connect_errno($con)) { echo "failed connect mysql: " . mysqli_connect_error(); } if (isset($_get["id"])) { $id =$_get["id"]; } $result = mysql_query("select * publication file_id='$id'"); $row1 = mysql_fetch_array($result); $title=$row1['title']; $author=$row1['author']; $year=$row1['year']; $abstract=$row1['abstract']; if(!empty($_session['username'])) { echo'<div class="popup">'; echo'<form method="post" action="public_edit.php" enctype="multipart/form-data">'; echo'<div>'; echo'<label for="citation">title</label>'; echo'<input style="width:100%;" type="text" name="title" id="title" value="'.$title.'">'; echo'</div>'; echo'<div>'; echo'<label for="citation">author</label>'; echo'<input style="width:100%;" type="text" name="author" id="author" value="'.$author.'">'; echo'</div>'; echo'<div>'; echo'<label for="citation">year</label>'; echo'<input style="width:100%;" type="year" name="year" id="year" value="'.$year.'">'; echo'</div>'; echo'<div>'; echo'<label for="abstract">abstract</label>'; echo'<textarea name="abstract" id="abstract" size="5000">'.$abstract.'</textarea>'; echo'</div>'; echo'<p>rechoose file here</p>'; echo'<input type="hidden" name="max_file_size" value="2000000">'; echo'<input name="userfile" type="file" id="userfile"> '; echo'<br/> '; echo'<input name="submit" type="submit" value="upload" style="width: 150px">'; echo'<a class="close" href="#close"></a>'; echo'</form>'; echo'</div>'; }
the problem faced not pass right id. no matter link click show data first id.
thanks helping me .
you need pass id parameter when calling pop up. replace echo statement in first code
echo '<span class=right><a href="#edit_form?id= ' .$id .'">[edit]</a>';
Comments
Post a Comment