How can i make a form that you submit then it edits a bit of a php file?
THanks :eusa_danc

How can i make a form that you submit then it edits a bit of a php file?
THanks :eusa_danc
there you go =]Form Code Details:
The QuikCode Wizard helps you to create HTML form code similar to the following:
<FORM METHOD="POST" ACTION="http://www.yoursite.com/cgi-bin/quikstore.cgi">
<INPUT TYPE="text" NAME="item-ZZ101|14.95|Candy|NA|1" size="3">
<INPUT TYPE="hidden" NAME="store_type" VALUE="html">
<INPUT TYPE="hidden" NAME="page" VALUE="products1.html">
<INPUT TYPE="submit" NAME="add_to_cart" VALUE="Add to Cart">
</FORM>
The first line is the opens the <form> and sets the method and action for the form. The "Method" should be POST and the "Action" should be set to the URL where the "quikstore.cgi" program is located on your server.
The second line in this example identifies the product and all of its' parameters. These parameters include product id, unit price, product name, size, and weight variables separated by pipes (|). This line is also the Quantity Box where the user selects a specified quantity to purchase.
Line number three tells the Quikstore program what type of store (store_type) is adding the item to the cart. This is so we can properly direct the user back to where they came from. The "store_type" variable is only required in HTML based stores.
Line number four tells the Quikstore program what the name of the page is that you are adding to the cart from. This page name is then used by the program to return the customer to the page they came from after they have added an item to their cart.
This page value MUST be the name of the current page. If you have this page in a subdirectory of the document root, you need to add the subdirectory name in front of the page name like this: VALUE="subdirectory/pagename.html" otherwise you will get a security check error when you try to add something to the cart.
DO NOT add a forward slash to the beginning of the page value like this: VALUE="/subdirectory/pagename.html". That will not work properly.
Line five is simply the Add To Cart button.
Line six closes the form tag.
At minimum, each <form> must contain the values listed above.
If you want more than one item on a page, and you would like to be able to add multiple items at one time, you would repeat ONLY the item specific lines above like this:
<FORM METHOD="POST" ACTION="http://www.yoursite.com/cgi-bin/quikstore.cgi">
<INPUT TYPE="hidden" NAME="store_type" VALUE="html">
<INPUT TYPE="hidden" NAME="page" VALUE="products1.html">
<P>Candy:
<INPUT TYPE="text" NAME="item-ZZ101|14.95|Candy|NA|1" size="3">
<INPUT TYPE="submit" NAME="add_to_cart" VALUE="Add to Cart"></p>
<P>Toy:
<INPUT TYPE="text" NAME="item-ZZ102|14.95|Toy|NA|1" size="3">
<INPUT TYPE="submit" NAME="add_to_cart" VALUE="Add to Cart"></p>
</FORM>
Each item must be identified individually. You may use more than one Add to Cart button or simply have one at the bottom of the form. Just continue to add additional lines as shown above, for each new item. There is no need to repeat the hidden "page" and "store_type" tags.
The example below is a complete basic HTML page and will place four input boxes on one page with an "Add to Cart" button at the bottom. Each item has different information and should be accompanied by the necessary pictures, graphics and text to assist the customer in making a choice. Based on the choice selected and the quantity input by the customer, the required parameters will be passed to the "quikstore.cgi" program by the "form" which is executed when the customer presses the "Add to Cart" button.
<HTML>
<HEAD>
<TITLE>Enter your title here.</TITLE>
</HEAD>
<BODY>
<FORM METHOD="POST" ACTION="http://www.yoursite.com/cgi-bin/quikstore.cgi">
<INPUT TYPE="hidden" NAME="page" VALUE="products.html">
<INPUT TYPE="hidden" NAME="store_type" VALUE="html">
<P>Candy
<INPUT TYPE="text" NAME="item-ZZ101|14.95|Candy|NA|1" SIZE="3"></P>
<P>More Candy
<INPUT TYPE="text" NAME="item-ZZ102|18.95|More Candy|NA|1" SIZE="3"></P>
<P>Alot of Candy
<INPUT TYPE="text" NAME="item-ZZ103|24.95|Alot Of Candy|NA|1" SIZE="3"></P>
<P><INPUT TYPE="submit" NAME="add_to_cart" VALUE="Add to Cart">
</FORM>
</BODY>
</HTML>
REMOVED
Edited by jesus (Forum Super Moderator): Please do not have images in your signature which are over the size limit for your usergroup.
What??????
That doesn't edit a selected bit of a php file does it?
Edit by Michael-W (Forum Mod): Please don't double post, use the 'edit' feature instead.
Last edited by Michael.; 10-09-2005 at 06:54 PM.
Sorry i sent you wrong thing lmaoo
REMOVED
Edited by jesus (Forum Super Moderator): Please do not have images in your signature which are over the size limit for your usergroup.
can you send the right one lol![]()
if you have it
right make a file called edit.php and add this code
That should workk... ive taken it from my cms, so im not sure if the code is completely right...PHP Code:<?
// Submission Part
if ($submit) {
$fp = fopen('YOURPAGE.php', 'w');
fwrite($fp, stripslashes($newdata));
fclose($fp);
}
$fp = fopen('YOURPAGE.php', 'r');
while (!feof($fp)) {
$data .= fgets($fp, 4096);
}
fclose($fp);
echo "
<html>
<head>
<title>PAGE</title>
</head>
<body>
<form action='edit.php' method='post'>
<textarea name='newdata' rows='20' cols='50'>
$data
</textarea>
<br>
<input type='submit' name='submit' value='Submit'>
</form>
</body>
</html>";
?>
*Image Removed
Ahemm.. How exactly was my sig innapropriate?
Goddamit i hate this forum :@
I RESIGN FROM GRAPHICS DESIGNER :@ :@ :@
How does it work?
can anyone help me?
Want to hide these adverts? Register an account for free!