473,624 Members | 2,186 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to assign HTML tag to array?


Hello group,

How can I assign a link with its related elements (as following) to an
array element?
Assume having a table with several rows and 3 columns.
The first column holding some text information (which will be read
from a database) but
the 2nd column holding a link (as its previous rows - now I'm adding a
new row).

Since I'm adding records or rows to this table I need to provide the
link in the 2nd column and the worst thing thing, this is my first PHP
project!

Any advice?

<span id=\"button_<?= $item?>_edit\"> <a href=\"javascri pt:edit('<?=
$item?>', 1, '<?=$max?>');
javascript:MyFu nc(document.get ElementById('ip text_<?=$item?> '));\"
>Edit</a</span>;


This is what I have done but doesn't work:

myArray[1] = myArray[1] + "<span id=\"button_<?= $item?>_edit \">";
myArray[1] = myArray[1] + "<a href=\"javascri pt:edit('<?=$it em?>', 1,
'<?=$max?>');" ;
myArray[1] = myArray[1] +
"javascript:myF unc(document.ge tElementById('i ptext_<?=$item? >'));\"
>Edit</a</span>";

Regards,
Amit

May 1 '07 #1
3 3251
amit said the following on 5/1/2007 4:34 PM:
>

Hello group,

How can I assign a link with its related elements (as following) to an
array element?
Assume having a table with several rows and 3 columns.
The first column holding some text information (which will be read
from a database) but
the 2nd column holding a link (as its previous rows - now I'm adding a
new row).

Since I'm adding records or rows to this table I need to provide the
link in the 2nd column and the worst thing thing, this is my first PHP
project!

Any advice?

<span id=\"button_<?= $item?>_edit\"> <a href=\"javascri pt:edit('<?=
$item?>', 1, '<?=$max?>');
javascript:MyFu nc(document.get ElementById('ip text_<?=$item?> '));\"
>Edit</a</span>;
Don't post the PHP code, post the code the browser gets. If you view
source in the browser you won't see a close for the <a tag and probably
looks something like this:

<span id="button_some thing_edit">
<a href="javascrip t:edit('somethi ng','1','maxSom ething');
javascript:MyFu nc(document.get ElementById('ip text_something' ));"
Edit
</a>
</span>

I prettied it up to prevent line wrapping.

Note the lack of the Before the word Edit so that it isn't valid HTML.
Also, don't use javascript: pseudo-protocols.
<URL: http://jibbering.com/faq/index.html#FAQ4 _24>
If you don't need the link action, use a button.
Also, what is the point in wrapping a link in a span element?
<button onclick="edit(' something'..... ..)">Edit</button>
This is what I have done but doesn't work:

myArray[1] = myArray[1] + "<span id=\"button_<?= $item?>_edit \">";
myArray[1] = myArray[1] + "<a href=\"javascri pt:edit('<?=$it em?>', 1,
'<?=$max?>');" ;
myArray[1] = myArray[1] +
"javascript:myF unc(document.ge tElementById('i ptext_<?=$item? >'));\"
>Edit</a</span>";
Again, the PHP code isn't of much use. Post the code that the browser
gets. What is the intent for the array you are creating?
--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 1 '07 #2
On May 1, 2:40 pm, Randy Webb <HikksNotAtH... @aol.comwrote:
amit said the following on 5/1/2007 4:34 PM:


Hello group,
How can I assign a link with its related elements (as following) to an
array element?
Assume having a table with several rows and 3 columns.
The first column holding some text information (which will be read
from a database) but
the 2nd column holding a link (as its previous rows - now I'm adding a
new row).
Since I'm adding records or rows to this table I need to provide the
link in the 2nd column and the worst thing thing, this is my first PHP
project!
Any advice?
<span id=\"button_<?= $item?>_edit\"> <a href=\"javascri pt:edit('<?=
$item?>', 1, '<?=$max?>');
javascript:MyFu nc(document.get ElementById('ip text_<?=$item?> '));\"
Edit</a</span>;

Don't post the PHP code, post the code the browser gets. If you view
source in the browser you won't see a close for the <a tag and probably
looks something like this:

<span id="button_some thing_edit">
<a href="javascrip t:edit('somethi ng','1','maxSom ething');
javascript:MyFu nc(document.get ElementById('ip text_something' ));"
Edit
</a>
</span>

I prettied it up to prevent line wrapping.

Note the lack of the Before the word Edit so that it isn't valid HTML.
Also, don't use javascript: pseudo-protocols.
<URL:http://jibbering.com/faq/index.html#FAQ4 _24>
If you don't need the link action, use a button.
Also, what is the point in wrapping a link in a span element?

<button onclick="edit(' something'..... ..)">Edit</button>
This is what I have done but doesn't work:
myArray[1] = myArray[1] + "<span id=\"button_<?= $item?>_edit \">";
myArray[1] = myArray[1] + "<a href=\"javascri pt:edit('<?=$it em?>', 1,
'<?=$max?>');" ;
myArray[1] = myArray[1] +
"javascript:myF unc(document.ge tElementById('i ptext_<?=$item? >'));\"
Edit</a</span>";

Again, the PHP code isn't of much use. Post the code that the browser
gets. What is the intent for the array you are creating?
--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptT oolbox.com/bestpractices/


Sure. first thanks for your response.

Assume having a table with several rows and 3 columns.
The first column holding some text information (which will be read
from a database) but
the 2nd column holding a link. Since I'm adding records or rows to
this table I need to provide the link in the 2nd column and the worst
thing thing, this is my first PHP project!

Any advice?

May 1 '07 #3
On May 1, 3:16 pm, amit <amit.ko...@gma il.comwrote:
On May 1, 2:40 pm, Randy Webb <HikksNotAtH... @aol.comwrote:
amit said the following on 5/1/2007 4:34 PM:
Hello group,
How can I assign a link with its related elements (as following) to an
array element?
Assume having a table with several rows and 3 columns.
The first column holding some text information (which will be read
from a database) but
the 2nd column holding a link (as its previous rows - now I'm adding a
new row).
Since I'm adding records or rows to this table I need to provide the
link in the 2nd column and the worst thing thing, this is my first PHP
project!
Any advice?
<span id=\"button_<?= $item?>_edit\"> <a href=\"javascri pt:edit('<?=
$item?>', 1, '<?=$max?>');
javascript:MyFu nc(document.get ElementById('ip text_<?=$item?> '));\"
>Edit</a</span>;
Don't post the PHP code, post the code the browser gets. If you view
source in the browser you won't see a close for the <a tag and probably
looks something like this:
<span id="button_some thing_edit">
<a href="javascrip t:edit('somethi ng','1','maxSom ething');
javascript:MyFu nc(document.get ElementById('ip text_something' ));"
Edit
</a>
</span>
I prettied it up to prevent line wrapping.
Note the lack of the Before the word Edit so that it isn't valid HTML.
Also, don't use javascript: pseudo-protocols.
<URL:http://jibbering.com/faq/index.html#FAQ4 _24>
If you don't need the link action, use a button.
Also, what is the point in wrapping a link in a span element?
<button onclick="edit(' something'..... ..)">Edit</button>
This is what I have done but doesn't work:
myArray[1] = myArray[1] + "<span id=\"button_<?= $item?>_edit \">";
myArray[1] = myArray[1] + "<a href=\"javascri pt:edit('<?=$it em?>', 1,
'<?=$max?>');" ;
myArray[1] = myArray[1] +
"javascript:myF unc(document.ge tElementById('i ptext_<?=$item? >'));\"
>Edit</a</span>";
Again, the PHP code isn't of much use. Post the code that the browser
gets. What is the intent for the array you are creating?
--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptT oolbox.com/bestpractices/

Sure. first thanks for your response.

Assume having a table with several rows and 3 columns.
The first column holding some text information (which will be read
from a database) but
the 2nd column holding a link. Since I'm adding records or rows to
this table I need to provide the link in the 2nd column and the worst
thing thing, this is my first PHP project!

Any advice?

Actually what matter is not PHP is JavaScript here since this works on
client side not PHP.

Regards,
amit

May 1 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
6743
by: Golf Nut | last post by:
I am finding that altering and affecting values in elements in multidimensional arrays is a huge pain in the ass. I cannot seem to find a consistent way to assign values to arrays. Foreach would clearly be the most efficient way to do it, but it only works on a copy of the original array and not the original (which is counter intuitive in my estimation). Using each doesn't work consistently either. Not only that, it's unduly complex for...
6
644
by: Ram Laxman | last post by:
Hi all, Can I assign an array to a vector if both(array and vector) holds same data type?
3
12476
by: N. Demos | last post by:
How do you dynamically assign a function to an element's event with specific parameters? I know that the code is different for MSIE and Mozilla, and need to know how to do this for both. I have the following event handler functions defined and need to assign them to table elements (<TD>) created dynamically in another function. function handleMouseOver(elt, cssClass, strURL)
16
25404
by: sneill | last post by:
How is it possible to take the value of a variable (in this case, MODE_CREATE, MODE_UPDATE, etc) and use that as an object property name? In the following example I want 'oIcon' object to have the properties: mode1, mode2, and mode3. This seems simple but I can't quite figure it out... Any ideas anyone?
3
1540
by: Makiyo | last post by:
how do u do something like this char x; x = "hello"; I got an error, but is there a way I can do it without using pointer? thx ; )
26
7063
by: Brett | last post by:
I have created a structure with five fields. I then create an array of this type of structure and place the structure into an array element. Say index one. I want to assign a value to field3 of the structure inside the array. When I try this, an error about late assignment appears. Is it possible to assign a value to a structure field that is in an array? I'm currently getting around the problem by creating a new structure, assign...
7
2716
by: Chris Wertman | last post by:
I am so lost on this one. Dim Ary as Integer = New Integer(4) {0,1,2,3} FAILS with the error: Array initializer has 1 too few elements. So I try Dim Ary as Integer = New Integer(3) {0,1,2,3} Since arrays start at 0 (I am thinking)
4
7342
by: johnners | last post by:
Hi all I'm having trouble assigning an attribute to a namespace using nusoap/php when creating a new soapclient. I can get the soapclient to assign the parameters correctly but can't assign an attribute to any namespaces. The code below is from the actual soap request and i need to assign the 'ApplicantID' from the soapclient to the Applicant parameter for each new applicant, then have nested arrays within various arrays. <Applicant...
2
7539
by: Akino877 | last post by:
Hello, I am new to HTML and PHP. And I am trying to assign an array of values to the <option value=...> of a combo list. But what I am trying to do is not working. I can sucessfully get it to work if I assign each value separately. I wonder if anyone could please help me with this problem. Below is my code. Thank you and Best Regards,
0
8236
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8173
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8621
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8475
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7159
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5563
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4079
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.