Jump to content

Editable Field


gamercross

Recommended Posts

Hi, im looking for a script that i can place a little box on my site, and then through a form on an alternate location, edit what is in the box, if possible using a wysiwyg editor so i can also make images appear in the box etc. I thought this was more html orientated, but may contain an aspect of php.

 

Thanks, Awaiting a Response,

 

Gamercross

Link to comment
Share on other sites

  • 2 weeks later...

Hello, hope  this will helps you

 

- index.php (Where Box Has to be appea)

- edit.php (Where You Edit The box)

 

-Create Table iN Database

table_name

--field1(TEXT)

 

INDEX.PHP - PUT THIS CODE WHERE YOU WANT TO SHOW YOUR BOX

<?php

//After Connectin to database

$query=mysql_query("SELECT * FROM table_name");

$data = mysql_fetch_array($query);

echo $data['field1'];

?>

 

EDIT.PHP

<?php

//After Connection to Database

if(isset($_POST['submit'])){

$box = $_POST['text_box'];

$query = mysql_query("INSERT INTO table_name(field1)VALUES('".$box."')");

echo "Data Has Been Added";

}

$query=mysql_query("SELECT * FROM table_name");

$data = mysql_fetch_array($query);

?>

<form name="form1" method="post" action="">

  <label>

  <textarea name="text_box" cols="45" rows="5" id="text_box">echo $data['field1'];</textarea>

  <br>

  </label>

  <label>

  <input name="submit" type="submit" id="submit" value="Submit">

  </label>

</form>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.