473,385 Members | 1,752 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,385 software developers and data experts.

How to get input box value as <a href=?

ddtpmyra
333 100+
How to use the value of the input box to my <a href> link? Below doesnt work. Any ideas?

Expand|Select|Wrap|Line Numbers
  1. <tr><td>Contact";
  2. echo "<input type=\"text\" name=\"contactid\"  id='contactid' </input>
  3. <a href='edit_entry.php?contactid='$contactid'>Edit";
thanks!
Nov 6 '09 #1
4 8176
Dormilich
8,658 Expert Mod 8TB
use JavaScript. PHP can’t handle events.
Nov 6 '09 #2
TheServant
1,168 Expert 1GB
PHP can only be run before the page has sent (and is visible on a users browser). Javascript works only after the page has sent and is executed by the users browser.

If you want to change anything after the page has been sent and is visible, you need Javascript, but if it can be before you can use PHP.

To get a variable sent by a form (eg. method="post") you can have:
Expand|Select|Wrap|Line Numbers
  1. echo $_POST['my_input_name'];
But that will only work once the form has been submitted to the server. Hope that makes sense.
Nov 6 '09 #3
ddtpmyra
333 100+
Thanks for all infos.

I think I was sucessufully re-work my link code, I just have to use other alternitive way on using quote. I dont know how it works but here's what i did.

Expand|Select|Wrap|Line Numbers
  1. <a href=\"edit_entry_contact_edit.php?contactid='$contactid'\">    Edit </a>";
Nov 6 '09 #4
TheServant
1,168 Expert 1GB
Glad it's solved. It's hard to say without the code obviously prior to this. You would have to define $contactid from somewhere, and if it's coming from a form, it would be from $_GET or $_POST. If you're happy, we're happy, but let us know if you have any more trouble or questions.
Nov 7 '09 #5

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

Similar topics

2
by: Keiron Waites | last post by:
I have the following code: <input type="text" name="search" class="search_top"> <a href="" onclick="window.location='search.inc.php'+document..search. value; return false;"...
3
by: TR | last post by:
Is it possible with CSS to prevent this wrapping alignment with a checkbox with a nested label? This is the label of the checkbox that wraps beneath it I'd prefer it looked like...
6
by: snacktime | last post by:
I've searched and searched and have not found a solution to suppress the margin on form or href tags so that there is no space before or after the tag. The only way I have found to do this is to...
5
by: specjal | last post by:
hi in form TEXTAREA i have text like: bla bla http://www.google.com/bla/bla/bla text text text text now how to make from this text like: bla bla text text text text
13
by: tperri | last post by:
I have an HTML table with several fields like this: <A href="Savings.aspx?category=Food"><asp:imagebutton id="imgFood" ImageUrl="images\buttons\btn-food-i.gif"...
10
by: Iain | last post by:
Hi All My apologies if this appears to be simple to some of you but I have very little experience of javascript and I cannot work this one out, The code below is a nice piece of code I found...
1
by: swatidesai0407 | last post by:
im working on php i want the textbox value to pass in a href it goes as this <input type="text" name="use"> <a href="new.php?cat=textbox value dat is entered"> plz tell me wat to do
2
by: Peter Laman | last post by:
In my app I need to dynamically generate a series hyperlinks. Each hyperlink's action must be to focus a field in a <form>. I created the following function to create such a link (the argument is a...
5
by: prathapavp | last post by:
hi all, We r working on ERP sys and am doing crossBrowser compatibility. The problem is am not able to load one function by onClicking the refrence text . could u please help me out.
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.