Page 1 of 1

Help with link to post two bits of data to page

Posted: Mon Jun 27, 2005 7:45 am
by mhouldridge
Hi,

I have a php page that displays mysql data within text fields for a particular record.

The two fields I have are;

Code: Select all

<? echo $formVars["software"]; ?>
<? echo $formVars["license"]; ?>
Within the page this displays the software and license for a specific asset.

I would like to add a remove text link at the side of these elements which post to another page for storing purposes so that in the future people can see what software has been deleted from the system.

Any ideas, here is what I have;

Code: Select all

<? 
$datalink = $formVars["software"] & $formVars["license"];
$link = $datalink;
$post = 'http://www.audit.giacom.com/addto.php'; //d11wtq | added quotes you were missing 
$submit = PHPlink aref = $post;
echo $submit
?>
No I know the above is absolutely incorrect, but I am a noob to this and I think the structure is near.

thanks,
Mark



Posted: Mon Jun 27, 2005 10:41 am
by pickle
I'm a little unclear as to what you want. Do you want to attach those variables to the link in order to pass the information? If so, you can just attach the data as GET variables:

Code: Select all

<a href = &quote;addto.html?software=$software&license=$license&quote;>
However, if you're doing that, I'd suggest serializing it beforehand (look at serialize()).

Ultimately though, I'd strongly suggest making a small form and POSTing the data to your new page, rather than just using a simple link. Making a form rather than a link will stop some people from just typing in the URL of the page and putting their variables in the URL. It's a little harder to spoof a POST.

Posted: Tue Jun 28, 2005 5:54 am
by mhouldridge
Hi,

Yes - that is the way I would like to do it. The page is secure and is not used for public access so spoofing wont be a problem.

I would like to display the link as remove. How would I do this, I know this sounds daft but I am a complete noob to this.

thanks for your help so far!

Posted: Tue Jun 28, 2005 9:48 am
by pickle
Something like this should work:

Code: Select all

<a href = &quote;remove.html?software=$software&license=$license&quote;>
Remove
</a>
I'd still recommend serializing and unserializing the data though, if there's a chance special characters might be present - such as ? and & in particular.