Jump to content


Extremely simple CMS with JavaScript and php

home made cms

  • Please log in to reply
No replies to this topic

#1 htakeuchi

  • Members
  • Pip
  • Newbie
  • 7 posts

Posted 15 February 2013 - 05:36 PM


This is my first posting, I am fairly new to PHP and Javascript, so please be nice! :)

I have a question regarding a "Home Made" CMS for just a couple sections of the HTML on a site.

I have managed to obtain the HTML by calling it with "Include"

I use a couple forms which will gather the data to use for the change, then obtain the id of the DIV to change, all the changes happen by using some JQuery/Javascript, but since it is made by Javascript, all happens "Client side"... I am stuck here... and would like to see if there is a way to make PHP take the new changes into variables that will then replace the content in the HTML file?

Let's say...

I have a Fuel Pump and I have published the fuel price on my site...

I have to change the price every day... so I want a small "admin portal" where I can type the fuel price and with it submit the changes to the site...

here is the sample code I have been playing with so far...

<link href="test.css" rel="stylesheet" type="text/css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Testing Changes</title>
This section has the area you can modify:<br>
<form method="GET">
Change Fisrt line with: <input type="text" name="gasPrice1"><br>
Change Second line with: <input type="text" name="gasPrice2"><br>
<input type="submit" value="Change!">
echo "<br><br>";
include 'index.html';
echo "<br><br>";
$var1 = $_GET["gasPrice1"];
$var2 = $_GET["gasPrice2"];
echo "<br>";
echo $var1 . " This is the echo from the first Variable";
echo "<br>";
echo $var2 . " This is the echo from the second Variable";
var gPrice1 = "<?php echo $var1; ?>";
var gPrice2 = "<?php echo $var2; ?>";
var txt=document.getElementById("text1").innerHTML;

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users