473,378 Members | 1,344 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

retrieving id using button

Hello
I would like to know if there's any possible code for retrieving
id when we use button. Normally the button itself will only
functions if we use form action, however if i only
used that form action i can't pass the id value to the next particular
form. Therefore, i usually used the link function to retrieve id.
For example :

Expand|Select|Wrap|Line Numbers
  1. $result = mysql_query("SELECT * FROM gred",@ $db);
  2. $myrow = mysql_fetch_array($result);
  3.  
  4. echo "<a href=\"addform_obj.php?id=".$myrow["id"]."\">tambah </a>";
  5.  
  6.  
  7.  
Hence I need the same function like the one that the above link did to retrieve id; but yet using the button.
Nov 6 '06 #1
6 2984
$_REQUEST['id']
Nov 6 '06 #2
beter use
$id=mysql_fetch_field($field)
Nov 6 '06 #3
could both of you please give me some explaination...?
Nov 6 '06 #4
If you want the information from http://www.site.com/blah.php?id=section1&name=John&sec=9324

[PHP]
echo $_REQUEST['id'] . "<br>";
echo $_REQUEST['sec'] . "<br>";
echo $_REQUEST['name'];
[/PHP]
If purposely have them in a different order to show that the order doesn't matter.
The results from the above code are:
Expand|Select|Wrap|Line Numbers
  1. section1<br>9324<br>John
  2.  
And would show as:

section1
9324
John



Good?
Nov 7 '06 #5
eigun
1
Maybe not to retrieving id using a button but...
to submitting values(id) sent to a page using a button (without <form>...</form>)
try this..

[php]
// --- main.php file ---
//..........
$result = mysql_query("SELECT * FROM gred",@ $db);
$myrow = mysql_fetch_array($result);

// echo "<a href=\"addform_obj.php?id=".$myrow["id"]."\">tambah </a>";

// button to replace your link
echo "<input type=\"button\" value=\"Tambah\" onclick=\"location.href='addform_obj.php?id=".$myr ow["id"]."'\">";
//..........
[/php]
[php]
// --- example addform_obj.php file ---
$var = @$_GET['id']; //catch the "id"
echo "variabelnya : $var";
[/php]

GOOD LUCK...
http://nugie.web.ugm.ac.id/
Nov 21 '06 #6
ronverdonk
4,258 Expert 4TB
naughtybynature: I can no longer follow this discussion, as I think it is way off your original question. So that's why I ask you: is your problem/question solved/answered in any way or do you still have an issue open? And if so, could you explain what is still to be answered.

Thanks,

Ronald :cool:
Nov 21 '06 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Captain Dondo | last post by:
I am not really experienced in Javascript so bear with me.... I am working with an embedded platform; no mouse, no keyboard. Just up, down, left, right keys and +/- keys for...
3
by: =?Utf-8?B?Tmljaw==?= | last post by:
Hi all, i have a web application and one of the function is to generate a word document by button click. it works fine in debug mode when i run this web application. But after i deploy to my...
2
by: Hyperion | last post by:
Hello all, Im very new to php ,when I check execute this progrm the values from the database are retrieving and didplyed in a row.When I click the particul;ar edit button of a row ,I...
2
by: 4Ankit | last post by:
hello all, i am having some difficulty retrieving information from my form. I want to add content in my table but the content i want to add to the table is what the user inputs in my form. ...
0
bmallett
by: bmallett | last post by:
First off, i would like to thank everyone for any and all help with this. That being said, I am having a problem retrieving/posting my dynamic form data. I have a form that has multiple options...
0
by: radwa | last post by:
hey i'm having problems in retrieving controls(textboxs,buttons) from any webapplication(html documents) this is the code i'm using when i try to retrieve the search textbox in www.google.com i...
3
by: BlackShadow33p1 | last post by:
I'm trying to write a program in C++ that gets the handles of all the visible entries in the windows taskbar. The method I've used so far is to send the TB_GETBUTTON message to the taskbar. ...
34
by: vpriya6 | last post by:
Hi guys, I am new to Ajax, xml and javascript. I want to know how can I retrieve data from xml and display in the html page? please help me out. suppose my xml file is customer.xml the code...
0
by: Phijo | last post by:
Hello, I'm a Java developer but brand new to ASP (i have done some of the tutorials) so I have some ASP programming background however I cannot find the cause or the fix to this problem. I am...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.