The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Missing "
tudsy
post Jun 25 2021, 06:57 AM
Post #1


Advanced Member
****

Group: Members
Posts: 246
Joined: 30-September 14
Member No.: 21,611



Hi

I was wondering what is wrong with the following statement:



echo "<td>" . "<a href='edit1.php?id=<?php echo $data['CustomersArtitemid']; ?>'. ">". 'Edit'.'</a>' . '</td>';


I cant see it.


Thanks for any help.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jun 25 2021, 07:45 AM
Post #2


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



Shouldn't the first double quote here be matched by a closing double quote instead of a single one?

"<a href='edit1.php?id=<?php echo $data['CustomersArtitemid']; ?>'
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
tudsy
post Jun 25 2021, 08:12 AM
Post #3


Advanced Member
****

Group: Members
Posts: 246
Joined: 30-September 14
Member No.: 21,611



QUOTE(pandy @ Jun 25 2021, 10:15 PM) *

Shouldn't the first double quote here be matched by a closing double quote instead of a single one?

"<a href='edit1.php?id=<?php echo $data['CustomersArtitemid']; ?>'



Thanks for that.

I have to close the a tag but I dont know how.

Thanks.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jun 25 2021, 08:19 AM
Post #4


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



Looks closed to me.

"<a href='edit1.php?id=<?php echo $data['CustomersArtitemid']; ?>'. ">". 'Edit'.'</a>'

You have the closing tag for A and the start tag is closed properly too. Or do I miss something?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
tudsy
post Jun 25 2021, 09:21 AM
Post #5


Advanced Member
****

Group: Members
Posts: 246
Joined: 30-September 14
Member No.: 21,611



QUOTE(pandy @ Jun 25 2021, 10:49 PM) *

Looks closed to me.

"<a href='edit1.php?id=<?php echo $data['CustomersArtitemid']; ?>'. ">". 'Edit'.'</a>'

You have the closing tag for A and the start tag is closed properly too. Or do I miss something?




Thanks again.


The error is a syntax error: unexpected end of file expecting a t_string ......................
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
tudsy
post Jun 25 2021, 09:21 AM
Post #6


Advanced Member
****

Group: Members
Posts: 246
Joined: 30-September 14
Member No.: 21,611



QUOTE(pandy @ Jun 25 2021, 10:49 PM) *

Looks closed to me.

"<a href='edit1.php?id=<?php echo $data['CustomersArtitemid']; ?>'. ">". 'Edit'.'</a>'

You have the closing tag for A and the start tag is closed properly too. Or do I miss something?




Thanks again.


The error is a syntax error: unexpected end of file expecting a t_string ......................
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
tudsy
post Jun 25 2021, 11:06 AM
Post #7


Advanced Member
****

Group: Members
Posts: 246
Joined: 30-September 14
Member No.: 21,611



QUOTE(tudsy @ Jun 25 2021, 11:51 PM) *

QUOTE(pandy @ Jun 25 2021, 10:49 PM) *

Looks closed to me.

"<a href='edit1.php?id=<?php echo $data['CustomersArtitemid']; ?>'. ">". 'Edit'.'</a>'

You have the closing tag for A and the start tag is closed properly too. Or do I miss something?




Thanks again.


The error is a syntax error: unexpected end of file expecting a t_string ......................



here is the code.Attached File  view.php ( 5.24k ) Number of downloads: 123
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jun 26 2021, 05:20 AM
Post #8


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



Above me, I'm afraid. You have to wait for Christian to wake up. tongue.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Jun 26 2021, 08:51 AM
Post #9


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



echo "<td>" . "<a href='edit1.php?id=<?php echo $data['CustomersArtitemid']; ?>'. ">". 'Edit'.'</a>' . '</td>';

Looks awfully confused. Presumably this is "inside" php (i.e. preceded by a <? tag somewhere), so you have:

echo // this echoes the following string(s)
"<td>" // will echo <td>
. // is the string concatenation operator so it will now echo the next string, from the first " to to closing "
"<a href='edit1.php?id=<?php echo $data['CustomersArtitemid']; ?>'. "

So far then you expect to get
<td><a href='edit1.php?id=<?php echo $data['CustomersArtitemid']; ?>'.

I do not think this is what you mean. If you want to echo a bunch of text with just one bit of PHP in it, just switch off php except for the one bit:

?>
<td><a href='edit1.php?id=<?php echo $data['CustomersArtitemid']; ?>'>Edit</a></td>

I think that is what you mean; the php "short form" helps more with readability:

<td><a href='edit1.php?id=
<?=$data['CustomersArtitemid']?>'>Edit</a></td>

I think it is much simpler as far as possible to turn everything that is going to be echoed into a simple variable, like this:

$id = $data['CustomersArtitemid'];
echo "<td><a href=\"edit1.php?id=$id\">Edit</a></td>\n";

(If you use single quotes you don't have to escape them, but it's more conventional to use double quotes in html, I think.)
HTH


User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th April 2024 - 12:29 AM