
amplexus
Members-
Posts
55 -
Joined
-
Last visited
Never
About amplexus
- Birthday 07/30/1970
Contact Methods
-
AIM
elrod523
Profile Information
-
Gender
Male
-
Location
Portland, Maine
amplexus's Achievements

Newbie (1/5)
0
Reputation
-
very simple cms form problem [MODIFIED and formatted :)]
amplexus replied to amplexus's topic in PHP Coding Help
the site is hosted by Godaddy. is there a way to turn something like that off? -
very simple cms form problem [MODIFIED and formatted :)]
amplexus replied to amplexus's topic in PHP Coding Help
okay, have to revive this thread. what I've discovered when I gave this to the client is that they LOVE to use contractions in their copy. Every time they put an apostrophe, PHP puts a backslash, so it's becomes it\'s. is there a way to tell php that this is a .txt file it is writing to? -
using php to add id to an element based on current page
amplexus replied to amplexus's topic in PHP Coding Help
huh. whaddya know. thanks! -
Hi again, I've got a php include for a Navigation list, and I'm trying to get it to add the id tag to the current page. my code looks like this: <a href="order.php"<?php if ($currentpage == 'order.php') {echo 'id="here"';} ?>>Order Lobsters</a> |<a href="about.php"<?php if ($currentpage == 'about.php') {echo 'id="here"';} ?>>About Us</a> |<a href="crew.php"<?php if ($currentpage == 'crew.php') {echo 'id="here"';} ?>>Our Crew</a> |<a href="rental.php"<?php if ($currentpage == 'rental.php') {echo 'id="here"';} ?>>Rental Property</a> |<a href="contact.php"<?php if ($currentpage == 'contact.php') {echo 'id="here"';} ?>>Contact Us</a> |<a href="facility.php"<?php if ($currentpage == 'facility.php') {echo 'id="here"';} ?>>Our Green Facility</a> I'm not getting any errors, just not working. if I remove the "if" statement, the echo works, so I know my problem is there. maybe I have the wrong syntax for the page name string? where is it looking to get that information? I've only tested on my local xampp server, but these are relative links, no? thanksi n advance for your help.
-
very simple cms form problem [MODIFIED and formatted :)]
amplexus replied to amplexus's topic in PHP Coding Help
and so I've got this, and thank you for the changing names idea, I also figured out that I needed to change the textarea name. it seems to be working okay... <body> Edit copy for Homepage to appear as you want on the website, then click "update" <? if($_POST['home']){ $open = fopen("index.txt","w+"); $text = $_POST['hometext']; fwrite($open, $text); fclose($open); echo "<br /><br /><br />File updated to:<br /><br /><br />"; ?> <a href="../index.php">View Live Results</a><br /> <br /> <br /> <? $file = file("index.txt"); foreach($file as $text) { echo $text."<br />"; } }else{ $file = file("index.txt"); echo "<form action=\"".$PHP_SELF."\" method=\"post\">"; echo "<textarea Name=\"hometext\" cols=\"50\" rows=\"10\">"; foreach($file as $text) { echo $text; } echo "</textarea>"; echo "<input name=\"home\" type=\"submit\" value=\"Update Homepage\" />\n </form>"; } ?> Edit copy for About Us page to appear as you want on the website, then click "update" <? if($_POST['about']){ $open = fopen("about.txt","w+"); $text = $_POST['about_text']; fwrite($open, $text); fclose($open); echo "<br /><br /><br />File updated to:<br /><br /><br />"; ?> <a href="../about.php">View Live Results</a><br /> <br /> <br /> <? $file = file("about.txt"); foreach($file as $text) { echo $text."<br />"; } }else{ $file = file("about.txt"); echo "<form action=\"".$PHP_SELF."\" method=\"post\">"; echo "<textarea Name=\"about_text\" cols=\"50\" rows=\"10\">"; foreach($file as $text) { echo $text; } echo "</textarea>"; echo "<input name=\"about\" type=\"submit\" value=\"Update about us\" />\n </form>"; } ?> Edit copy for Rental Property Page to appear as you want on the website, then click "update" <? if($_POST['Stental']){ $open = fopen("rental.txt","w+"); $text = $_POST['rental_text']; fwrite($open, $text); fclose($open); echo "<br /><br /><br />File updated to:<br /><br /><br />"; ?> <a href="../rental.php">View Live Results</a><br /> <br /> <br /> <? $file = file("rental.txt"); foreach($file as $text) { echo $text."<br />"; } }else{ $file = file("rental.txt"); echo "<form action=\"".$PHP_SELF."\" method=\"post\">"; echo "<textarea Name=\"tental_text\" cols=\"50\" rows=\"10\">"; foreach($file as $text) { echo $text; } echo "</textarea>"; echo "<input name=\"rental\" type=\"submit\" value=\"Update Rental Text\" />\n </form>"; } ?> Edit copy for Crew to appear as you want on the website, then click "update" <? if($_POST['crew']){ $open = fopen("crew.txt","w+"); $text = $_POST['crew_text']; fwrite($open, $text); fclose($open); echo "<br /><br /><br />File updated to:<br /><br /><br />"; ?> <a href="../crew.php">View Live Results</a><br /> <br /> <br /> <? $file = file("crew.txt"); foreach($file as $text) { echo $text."<br />"; } }else{ $file = file("crew.txt"); echo "<form action=\"".$PHP_SELF."\" method=\"post\">"; echo "<textarea Name=\"crew_text\" cols=\"50\" rows=\"10\">"; foreach($file as $text) { echo $text; } echo "</textarea>"; echo "<input name=\"crew\" type=\"submit\" value=\"Update Crew Text\" />\n </form>"; } ?> Edit copy for Order Lobsters to appear as you want on the website, then click "update" <? if($_POST['order']){ $open = fopen("order.txt","w+"); $text = $_POST['order_text']; fwrite($open, $text); fclose($open); echo "<br /><br /><br />File updated to:<br /><br /><br />"; ?> <a href="../order.php">View Live Results</a><br /> <br /> <br /> <? $file = file("order.txt"); foreach($file as $text) { echo $text."<br />"; } }else{ $file = file("order.txt"); echo "<form action=\"".$PHP_SELF."\" method=\"post\">"; echo "<textarea Name=\"order_text\" cols=\"50\" rows=\"10\">"; foreach($file as $text) { echo $text; } echo "</textarea>"; echo "<input name=\"order\" type=\"submit\" value=\"Update Order Page Text\" />\n </form>"; } ?> which seems to be working fine. if you're so inclined, do you see any problems? I know about security,and will be adding a passcode protection before going "live" -
very simple cms form problem [MODIFIED and formatted :)]
amplexus replied to amplexus's topic in PHP Coding Help
so, In the last bit you can see (I hope)that I've changed the first form to have a name of "home" and adjusted the $_POST value to "home" as well. this has the effect of changing just the one value, and leaving the other forms intact. however, it also seems to change the .txt value to a blank. I'm thinking that the fwrite value needs to be changed, am I barking up the right tree here? -
very simple cms form problem [MODIFIED and formatted :)]
amplexus replied to amplexus's topic in PHP Coding Help
[code} <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> Edit copy for Homepage to appear as you want on the website, then click "update" <? if($_POST['home']){ $open = fopen("index.txt","w+"); $text = $_POST['update']; fwrite($open, $text); fclose($open); echo "<br /><br /><br />File updated to:<br /><br /><br />"; ?> <a href="../index.php">View Live Results</a><br /> <br /> <br /> <? $file = file("index.txt"); foreach($file as $text) { echo $text."<br />"; } }else{ $file = file("index.txt"); echo "<form action=\"".$PHP_SELF."\" method=\"post\">"; echo "<textarea Name=\"home\" cols=\"50\" rows=\"10\">"; foreach($file as $text) { echo $text; } echo "</textarea>"; echo "<input name=\"home\" type=\"submit\" value=\"Update\" />\n </form>"; } ?> Edit copy for About Us page to appear as you want on the website, then click "update" <? if($_POST['Submit']){ $open = fopen("about.txt","w+"); $text = $_POST['update']; fwrite($open, $text); fclose($open); echo "<br /><br /><br />File updated to:<br /><br /><br />"; ?> <a href="../about.php">View Live Results</a><br /> <br /> <br /> <? $file = file("about.txt"); foreach($file as $text) { echo $text."<br />"; } }else{ $file = file("about.txt"); echo "<form action=\"".$PHP_SELF."\" method=\"post\">"; echo "<textarea Name=\"update\" cols=\"50\" rows=\"10\">"; foreach($file as $text) { echo $text; } echo "</textarea>"; echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n </form>"; } ?> Edit copy for Rental Property Page to appear as you want on the website, then click "update" <? if($_POST['Submit']){ $open = fopen("rental.txt","w+"); $text = $_POST['update']; fwrite($open, $text); fclose($open); echo "<br /><br /><br />File updated to:<br /><br /><br />"; ?> <a href="../rental.php">View Live Results</a><br /> <br /> <br /> <? $file = file("rental.txt"); foreach($file as $text) { echo $text."<br />"; } }else{ $file = file("rental.txt"); echo "<form action=\"".$PHP_SELF."\" method=\"post\">"; echo "<textarea Name=\"update\" cols=\"50\" rows=\"10\">"; foreach($file as $text) { echo $text; } echo "</textarea>"; echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n </form>"; } ?> Edit copy for Crew to appear as you want on the website, then click "update" <? if($_POST['Submit']){ $open = fopen("crew.txt","w+"); $text = $_POST['update']; fwrite($open, $text); fclose($open); echo "<br /><br /><br />File updated to:<br /><br /><br />"; ?> <a href="../crew.php">View Live Results</a><br /> <br /> <br /> <? $file = file("crew.txt"); foreach($file as $text) { echo $text."<br />"; } }else{ $file = file("crew.txt"); echo "<form action=\"".$PHP_SELF."\" method=\"post\">"; echo "<textarea Name=\"update\" cols=\"50\" rows=\"10\">"; foreach($file as $text) { echo $text; } echo "</textarea>"; echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n </form>"; } ?> Edit copy for Order Lobsters to appear as you want on the website, then click "update" <? if($_POST['Submit']){ $open = fopen("order.txt","w+"); $text = $_POST['update']; fwrite($open, $text); fclose($open); echo "<br /><br /><br />File updated to:<br /><br /><br />"; ?> <a href="../order.php">View Live Results</a><br /> <br /> <br /> <? $file = file("order.txt"); foreach($file as $text) { echo $text."<br />"; } }else{ $file = file("order.txt"); echo "<form action=\"".$PHP_SELF."\" method=\"post\">"; echo "<textarea Name=\"update\" cols=\"50\" rows=\"10\">"; foreach($file as $text) { echo $text; } echo "</textarea>"; echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n </form>"; } ?> </body> </html> -
I've replaced this thread with a new post that is modified. thx pikachu, I was too tired to remember to format correctly, my eyes were crossing, but I should have known better!
-
Hi, I'm creating a website, and want to have text on a portion of each page be editable by a non-tech, average user. I've created a form, and I've got it to work. I'm using .txt files. what I've tried to do is create one page that has all of the pages' editable areas on it, each one displaying the current text, and a submit button to make the changes live. in the code, the php to generate the forms is after each of the text lines beginning with "Edit copy". Problem: when you click any of the submit buttons, all of the areas update. is it that i need to make each separate form code have a different input name? here;s my code, formatted to make it easier to read, since I was completely exhausted before. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> Edit copy for Homepage to appear as you want on the website, then click "update" <? if($_POST['Submit']){ $open = fopen("index.txt","w+"); $text = $_POST['update']; fwrite($open, $text); fclose($open); echo "<br /><br /><br />File updated to:<br /><br /><br />"; ?> <a href="../index.php">View Live Results</a><br /><br /><br /> <? $file = file("index.txt"); foreach($file as $text) { echo $text."<br />"; } }else{ $file = file("index.txt"); echo "<form action=\"".$PHP_SELF."\" method=\"post\">"; echo "<textarea Name=\"update\" cols=\"50\" rows=\"10\">"; foreach($file as $text) { echo $text; } echo "</textarea>"; echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n </form>"; } ?> Edit copy for About Us page to appear as you want on the website, then click "update" <? if($_POST['Submit']){ $open = fopen("about.txt","w+"); $text = $_POST['update']; fwrite($open, $text); fclose($open); echo "<br /><br /><br />File updated to:<br /><br /><br />"; ?> <a href="../about.php">View Live Results</a><br /><br /><br /> <? $file = file("about.txt"); foreach($file as $text) { echo $text."<br />"; } }else{ $file = file("about.txt"); echo "<form action=\"".$PHP_SELF."\" method=\"post\">"; echo "<textarea Name=\"update\" cols=\"50\" rows=\"10\">"; foreach($file as $text) { echo $text; } echo "</textarea>"; echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n </form>"; } ?> Edit copy for Rental Property Page to appear as you want on the website, then click "update" <? if($_POST['Submit']){ $open = fopen("rental.txt","w+"); $text = $_POST['update']; fwrite($open, $text); fclose($open); echo "<br /><br /><br />File updated to:<br /><br /><br />"; ?> <a href="../rental.php">View Live Results</a><br /><br /><br /> <? $file = file("rental.txt"); foreach($file as $text) { echo $text."<br />"; } }else{ $file = file("rental.txt"); echo "<form action=\"".$PHP_SELF."\" method=\"post\">"; echo "<textarea Name=\"update\" cols=\"50\" rows=\"10\">"; foreach($file as $text) { echo $text; } echo "</textarea>"; echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n </form>"; } ?> Edit copy for Crew to appear as you want on the website, then click "update" <? if($_POST['Submit']){ $open = fopen("crew.txt","w+"); $text = $_POST['update']; fwrite($open, $text); fclose($open); echo "<br /><br /><br />File updated to:<br /><br /><br />"; ?> <a href="../crew.php">View Live Results</a><br /><br /><br /> <? $file = file("crew.txt"); foreach($file as $text) { echo $text."<br />"; } }else{ $file = file("crew.txt"); echo "<form action=\"".$PHP_SELF."\" method=\"post\">"; echo "<textarea Name=\"update\" cols=\"50\" rows=\"10\">"; foreach($file as $text) { echo $text; } echo "</textarea>"; echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n </form>"; } ?> Edit copy for Order Lobsters to appear as you want on the website, then click "update" <? if($_POST['Submit']){ $open = fopen("order.txt","w+"); $text = $_POST['update']; fwrite($open, $text); fclose($open); echo "<br /><br /><br />File updated to:<br /><br /><br />"; ?> <a href="../order.php">View Live Results</a><br /><br /><br /> <? $file = file("order.txt"); foreach($file as $text) { echo $text."<br />"; } }else{ $file = file("order.txt"); echo "<form action=\"".$PHP_SELF."\" method=\"post\">"; echo "<textarea Name=\"update\" cols=\"50\" rows=\"10\">"; foreach($file as $text) { echo $text; } echo "</textarea>"; echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n </form>"; } ?> </body> </html> what's wrong?
-
Hi, I'm creating a website, and want to have text on a portion of each page be editable by a non-tech, average user. I've created a form, and I've got it to work. I'm using .txt files. wht I've tried to do is create one page that has all of the pages' editable areas on it, each one displaying the current text, and a submit button to make the changes live. Problem: when you click any of the submit buttons, all of the areas update. here;s my code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> Edit copy for Homepage to appear as you want on the website, then click "update" <? if($_POST['Submit']){ $open = fopen("index.txt","w+"); $text = $_POST['update']; fwrite($open, $text); fclose($open); echo "<br /><br /><br />File updated to:<br /><br /><br />"; ?> <a href="../index.php">View Live Results</a><br /><br /><br /> <? $file = file("index.txt"); foreach($file as $text) { echo $text."<br />"; } }else{ $file = file("index.txt"); echo "<form action=\"".$PHP_SELF."\" method=\"post\">"; echo "<textarea Name=\"update\" cols=\"50\" rows=\"10\">"; foreach($file as $text) { echo $text; } echo "</textarea>"; echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n </form>"; } ?> Edit copy for About Us page to appear as you want on the website, then click "update" <? if($_POST['Submit']){ $open = fopen("about.txt","w+"); $text = $_POST['update']; fwrite($open, $text); fclose($open); echo "<br /><br /><br />File updated to:<br /><br /><br />"; ?> <a href="../about.php">View Live Results</a><br /><br /><br /> <? $file = file("about.txt"); foreach($file as $text) { echo $text."<br />"; } }else{ $file = file("about.txt"); echo "<form action=\"".$PHP_SELF."\" method=\"post\">"; echo "<textarea Name=\"update\" cols=\"50\" rows=\"10\">"; foreach($file as $text) { echo $text; } echo "</textarea>"; echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n </form>"; } ?> Edit copy for Rental Property Page to appear as you want on the website, then click "update" <? if($_POST['Submit']){ $open = fopen("rental.txt","w+"); $text = $_POST['update']; fwrite($open, $text); fclose($open); echo "<br /><br /><br />File updated to:<br /><br /><br />"; ?> <a href="../rental.php">View Live Results</a><br /><br /><br /> <? $file = file("rental.txt"); foreach($file as $text) { echo $text."<br />"; } }else{ $file = file("rental.txt"); echo "<form action=\"".$PHP_SELF."\" method=\"post\">"; echo "<textarea Name=\"update\" cols=\"50\" rows=\"10\">"; foreach($file as $text) { echo $text; } echo "</textarea>"; echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n </form>"; } ?> Edit copy for Crew to appear as you want on the website, then click "update" <? if($_POST['Submit']){ $open = fopen("crew.txt","w+"); $text = $_POST['update']; fwrite($open, $text); fclose($open); echo "<br /><br /><br />File updated to:<br /><br /><br />"; ?> <a href="../crew.php">View Live Results</a><br /><br /><br /> <? $file = file("crew.txt"); foreach($file as $text) { echo $text."<br />"; } }else{ $file = file("crew.txt"); echo "<form action=\"".$PHP_SELF."\" method=\"post\">"; echo "<textarea Name=\"update\" cols=\"50\" rows=\"10\">"; foreach($file as $text) { echo $text; } echo "</textarea>"; echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n </form>"; } ?> Edit copy for Order Lobsters to appear as you want on the website, then click "update" <? if($_POST['Submit']){ $open = fopen("order.txt","w+"); $text = $_POST['update']; fwrite($open, $text); fclose($open); echo "<br /><br /><br />File updated to:<br /><br /><br />"; ?> <a href="../order.php">View Live Results</a><br /><br /><br /> <? $file = file("order.txt"); foreach($file as $text) { echo $text."<br />"; } }else{ $file = file("order.txt"); echo "<form action=\"".$PHP_SELF."\" method=\"post\">"; echo "<textarea Name=\"update\" cols=\"50\" rows=\"10\">"; foreach($file as $text) { echo $text; } echo "</textarea>"; echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n </form>"; } ?> </body> </html> what's wrong?