Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Server-side Scripting _ Missing "

Posted by: tudsy Jun 25 2021, 06:57 AM

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.

Posted by: pandy Jun 25 2021, 07:45 AM

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']; ?>'

Posted by: tudsy Jun 25 2021, 08:12 AM

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.

Posted by: pandy Jun 25 2021, 08:19 AM

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?

Posted by: tudsy Jun 25 2021, 09:21 AM

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 ......................

Posted by: tudsy Jun 25 2021, 09:21 AM

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 ......................

Posted by: tudsy Jun 25 2021, 11:06 AM

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: 124

Posted by: pandy Jun 26 2021, 05:20 AM

Above me, I'm afraid. You have to wait for Christian to wake up. tongue.gif

Posted by: Brian Chandler Jun 26 2021, 08:51 AM

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



Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)