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
https://forums.phpfreaks.com/topic/91304-editable-field/
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
https://forums.phpfreaks.com/topic/91304-editable-field/#findComment-475046
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.