1

Topic: Html php command

Banging my head against the wall with this one. How might one go about implementing something along the lines of the following concept? I know even less of html than I do php, so not a good combination. big_smile

<button type=\"submit\" value=\"delete\" onclick=\"<?php rm (".$file1.", ".$file2."); ?>\">Delete</button>


Thanks in advance,

Matt

Re: Html php command

1. rm is not a PHP function
2. button should be input
3. PHP is done server side, so you need the user to submit a form with all the data

3

Re: Html php command

Smartys wrote:

1. rm is not a PHP function

Oops. Old habits die hard. big_smile Unlink is the one I have in there. That is the correct equivalent of rm, is it not?


Smartys wrote:

2. button should be input

Cheers. smile


Smartys wrote:

3. PHP is done server side, so you need the user to submit a form with all the data

Mind if I ask one more question on this bit? Do I take the php section out and supply the filenames to another script? Something along the lines of:

<form method=\"post\" action=\"page.php?subpage=\"delete\"?".$file1.",".$file2."\"><input type=\"submit\" value=\"Delete\" onclick=\"submit\"/></input></form>

Or can the deletion bit actually be called from within that section above? Apologies for what may appear to be obviously simple questions. smile I'm just having a tad of a problem getting my head around this bit.

p.s: Is there a good online resource for html scripting/writing information and tutorials?


Thanks ever so much once again,

Matt

Re: Html php command

You will indeed have to submit the files to be removed to an external file. And yes, unlink() is the correct function.

5

Re: Html php command

elbekko wrote:

You will indeed have to submit the files to be removed to an external file. And yes, unlink() is the correct function.

Cheers. smile The penny is finally beginning to drop with how to go about things now. big_smile One last question if I may. The HTTP_POST_VARS bit. Is there any documentation on the site regarding them, and the syntax that should be utilised with them, or is it a case of trying to figure it out from the various scripts?

Thanks once again,

Matt

Re: Html php command

One note before I start: $HTTP_POST_VARS is deprecated, you should use the $_POST superglobal instead
I'm not exactly sure what you mean, $_POST (and all the superglobals) are simply arrays with the keys being the parameters passed. So here for example, if my URL is http://punbb.org/forums/viewtopic.php?pid=91477, $_GET will contain one element, pid, with a value of 91477.

7

Re: Html php command

Smartys wrote:

One note before I start: $HTTP_POST_VARS is deprecated, you should use the $_POST superglobal instead

Thanks for that. I'll make sure I use that method. smile

Smartys wrote:

I'm not exactly sure what you mean, $_POST (and all the superglobals) are simply arrays with the keys being the parameters passed. So here for example, if my URL is http://punbb.org/forums/viewtopic.php?pid=91477, $_GET will contain one element, pid, with a value of 91477.

Apologies if I'm appearing a bit vague with my questions. Between trying to master the basics of both php and html, I am going into that mindstate of no return. big_smile What I was meaning to ask, working on your example above, is that if one wishes to pass more parameters, is the question mark the common seperator between all arguments/parameters passed? For example, would the following be correct format to use to pass multiple arguments:


http://punbb.org/forums/viewtopic.php?p … er=unknown


BTW, thanks ever so much to you all for your help and patience. smile


Matt

Re: Html php command

Aha smile

The beginning of the parameters in $_GET are marked by a ? and the individual parameters are seperated by &s
So, http://punbb.org/forums/viewtopic.php?p … er=unknown

9

Re: Html php command

Thanks. I think I might now have enough of a basic idea to be script dangerous. big_smile I should now be able to use trial and error to get my thoughts going down the right lines. big_smile Cheers once again.


Matt

10

Re: Html php command

Okay. Now I'm a really happy chappy. big_smile Thanks ever so much to you both for your help and advice. I've got a basic working setup. smile big_smile Thanks ever so much. smile