Welcome to WebmasterWorld Guest from 18.104.22.168
I have created a table where the first row is the headings and the next is a repeat region that populatd until the end of the table. I would like to make one of the fields a clickable link when i will pass the ID to another page for updating.
I cannot for the life of me get it to work. I want to make the $ID a link. Any help apprecatied.
"; etc etc
I am not sure if thats exactly what you are wanting or not though. What are you wanting the link to do exactly? Basically all you are going to have to do is put it in href and change it how you need it. If its going to a page called $ID.php just change it to be href="$ID.php" of course dont forget to pharse anything out that might need to be.
I just want to make one of the repeated sections a link. It falls down when i put a HREF tag in. I think it is something to do with mixing php and html and the fact that I dont really know when to use "s and 's and how many.
When I do this
It does not like it. Where the link goes at this stage doesnt bother me to much it is just the fact that i cannot make a dynamic element linkable.
For example, the first sentence in this post can be parsed like this:
Subject (noun phrase): "Parsing"
Predicator (verb phrase): "is"
Object (noun phrase): "a concept borrowed from grammar"
(Before any purists argue: Yes, in English grammar, the complement of "to be" is an object, so there.)
The object itself can be broken down into a noun phrase and an adjectival phrase.
You do this automatically in your brain, and this allows to work out the relationships between all the different words and so on.
Programming, scripting and markup languages have to be parsed in a similar way. The PHP parser breaks down a line of code into keywords, identifiers, values and so on.
Strings can be delimited by single or double quotes. But what happens if you want to include a quote inside your string? Take this line:
$quote="Hamlet said, "To be or not to be".";
The parser finds the identifier $quote, then the assignment operator = (which means "assign what's on the right of this operator to the identifier on the left"), then the double quote " which means, "From now until the next double quote is a literal string". It gets as far as:
"Hamlet said, "
...and that second double quote means, "The string ends here." Now the PHP parser is expecting something like a semicolon or a concatenation operator. Instead, it sees something it can't make sense of: what does To mean? It's not an operator, it's certainly not a semicolon, and it doesn't exist in PHP.
The backslash "escapes" the double quote: it means "Don't interpret the next character the way you normally do -- it's part of the string". So you have to write:
$quote="Hamlet said, \"To be or not to be\".";
When reading in values from form input fields, PHP automatically adds backslashes to escape all such characters -- just in case. But when you print them out on screen, because of the way it works, the backslashes actually get printed too. (This is because you're not printing a literal string, you're printing out the value of a variable.) To get around this, there is a function called stripslashes()
Use this when printing values taken from form input fields and databases, and the backslashes wil magically disappear.