Page 1 of 1
Posting data with link not working
Posted: Tue Jun 28, 2005 9:08 am
by mhouldridge
Hi,
I am trying to post three bits of data using a hyperlink to another page. Here is the code;
Code: Select all
<?
echo "<td><font color=\"red\"><ahref="addto.htmlasset=$asset&software=$software&license=$license">remove</a> </font></td> \n";
?>
Any ideas why this comes up with a T String error?
Posted: Tue Jun 28, 2005 9:11 am
by Chris Corbyn
Code: Select all
addto.htmlasset=$asset&software=$software&license=$license
What's addto (a constant?) and htmlasset (a constant you're trying to assing a value to?)... it makes no sense... what's it do?
Oh... I see... you're missing escaping quotes if I undertand you correctly.
Posted: Tue Jun 28, 2005 9:16 am
by mhouldridge
Sorry, the correct code should have been;
Code: Select all
<?
echo "<td><font color=\"red\"><a href="addto.html?asset=$asset&software=$software&license=$license">remove</a> </font></td> \n";
?>
Posted: Tue Jun 28, 2005 9:23 am
by mhouldridge
I have managed to get this going posting one variable, however with three variables and alternate text "remove", I am not having much luck.
Here is the code which works for the single posting one;
Code: Select all
echo "<TD><font color=\"red\"><b><a href='viewall.php?varl=".$row['asset']."'>".$row['asset']."</a></b></font></TD><TD><font size=\"2\">".$row['title']."</TD><TD><font size=\"2\">".$row['customer']."</TD><TD><font size=\"2\">".$row['type']."</TD><TD><font size=\"2\">".$row['IP']."</TD>\n";
Posted: Tue Jun 28, 2005 9:24 am
by Critta
Code: Select all
<?php
echo "e;<td><font color=\"e;red\"e;><a href=\"e;addto.html?asset="e;.$asset."e;&software="e;.$software."e;&license="e;.$license"e;\"e;>remove</a> </font></td> \n"e;;
?>
Should work. Not tested though
Posted: Tue Jun 28, 2005 9:28 am
by Chris Corbyn
Hint... please look at our syntax highlighting when you post your code...
Strings should be red.., constants, variables, and functions blue, delimiters green.
Yours is all blue which tell you something about the string....
Posted: Tue Jun 28, 2005 9:29 am
by Critta
wassup with mine, what have I done wrong to make it all green?
d11wtq | Dunno what you're talking about LOL
- Joking... you used
Posted: Tue Jun 28, 2005 9:36 am
by CoderGoblin
You may need to use
urlencode if your variables contain special characters.
Posted: Tue Jun 28, 2005 9:39 am
by Critta
d11wtq wrote:Dunno what you're talking about LOL

- Joking... you used
Code: Select all
tags [/color][/quote]
It's always something blindingly obvious isn't it, cheers
Posted: Tue Jun 28, 2005 10:09 am
by mhouldridge
Hi,
This is what I have now;
Code: Select all
<?
$remove = "remove";
echo "<a href='removeandstore.php?varl=".$row['asset']."'>".$remove."</a> \n"
?>
On the removeandstore.php page I have two text boxes, one software and the other license. Currently this will only display the value for that field;
I have used the following to show parts of the asset on the removeandstore.php;
My first page has numerous ssoftwares and licenses show, each with it's own remove link. I want the data from each software and license to be posted to the removeandstore.php page. Do I simply use the "&" symbol for this?
thanks
Posted: Tue Jun 28, 2005 10:19 am
by mhouldridge
Here is my updated code;
Code: Select all
<?
$remove = "remove";
echo "<a href='removeandstore.php?varl=".$formVars['software']."&var2=".$formVars['license']."'>".$remove."</a> \n"
?>