Jump to content

Archived

This topic is now archived and is closed to further replies.

sun14php

i want this..result

Recommended Posts

working on mysql with php, as my data is displayed in browser in the tabular form as below
id name class result
1 sun five

i want as i click (making id filed hyperlink) on particular id it automatically take me to update form an & i can update "result" filed thr after that. it also display the clicked id value in a text box.
how i code it ?

regards

Share this post


Link to post
Share on other sites
[!--quoteo(post=386801:date=Jun 22 2006, 07:29 AM:name=sun14php)--][div class=\'quotetop\']QUOTE(sun14php @ Jun 22 2006, 07:29 AM) [snapback]386801[/snapback][/div][div class=\'quotemain\'][!--quotec--]
working on mysql with php, as my data is displayed in browser in the tabular form as below
id name class result
1 sun five

i want as i click (making id filed hyperlink) on particular id it automatically take me to update form an & i can update "result" filed thr after that. it also display the clicked id value in a text box.
how i code it ?

regards
[/quote]

echo "<TD><a href=update.php?ID=1 target='_blank'>1</a></TD>";

Share this post


Link to post
Share on other sites
jvr,....
please clear........ does i put ID manually in hyperlink command ? if so i do'nt like that solution. understand my problem first

Share this post


Link to post
Share on other sites
[code]
echo "<TD><a href=update.php?"ID=".$id." target='_blank'>".$id."</a></TD>";
[/code]

use a variable to place the value if the correct places in the line

$id being the value you wish to pass to the update page.......

Share this post


Link to post
Share on other sites
hi,

  i could not get u please clarify more..

how do i access cell(hyperlink value ) into next php script

Share this post


Link to post
Share on other sites
[code]
        mysql_select_db ("menu");
        $result = mysql_query ("select * from linktable");
        if ($row=mysql_fetch_array($result)) {
//This is one way pull the whole string from a field
            echo "<a href = '/".$row['Link']."' TARGET='main'></p>";
//This is a second way by just adding the value to the Fixed URL
            echo "<a href = 'EditPage.php?id=".$id."' TARGET='main'></p>";           
            $row=mysql_fetch_array($result);
        }
[/code]

Share this post


Link to post
Share on other sites
jvrothjr,

  u tried the best , but i could not understatnd ru code. let me explain u.

A table showing records in browser as below(show.php):
ID          class        marks        result
1              12              67
2              11              67

now since i encapuslated id filed(cell) into hyperlink to take me to update.php page from show.php. At ths point if i click on id's fileds value assume on 1 it will take me to the update.php page ,here i want it display the id filed's value(which clicked in show.php page)on update.php, in our case, it's 1. Is it clear ?

Share this post


Link to post
Share on other sites
sorry no not clair

is the uodate working?

if so redirect user to there main page to see results?

redirect code from update

header("location: what ever page.php?&id=$id");


what ever page.php

view user results
<?

mysql_select_db ("menu");

$query = "select * from linktable where id=$id";

$result=mysql_query($query);

while(list($key,$value)=each($result) {

echo"<br> $key :  $value <br> ";

}

?>
 

An idear hope this helps.     

Share this post


Link to post
Share on other sites
here is an example:

page1.php
[code=php:0]
<?php
  echo "<a href='page2.php?id=2'>two</a>";
?>
[/code]

page2.php
[code=php:0]
<?php
  if ($_GET['id']) {
      $id = $_GET['id'];
      $sql = "update tablename set blah = 'blah' where id = '$id'";
      mysql_query($sql);
  }
?>
[/code] 

Share this post


Link to post
Share on other sites

×

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.