7 years ago
1
Topic

Hello, 

I managed to make a form for a list, for each item, like for comments And it grabs the values from the specific item in the list.

However although it does save the data e.g. comment, the relevant id of the article, or title. However then it reloads the page without reloading it right. I have also tried it on a category blog joomla native , and the same thing happens, but I dont want to use their forum because i don't want to let them in on it. 

If you can help you, it would be great and everyone can learn. 

// THE CODE (POSITION OVERRIDE)


<?php

// No Direct Access

defined( '_JEXEC' ) or die;

?>

<?php

echo $cck->renderField('art_title');

$mouse = $cck->getvalue('art_title');

?>

<?php

$app = JFactory:: getApplication();

$db = JFactory::getDBO();

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

{

$potato = $_POST['name'];

$potato1 = $_POST['mouse'];

$query = "INSERT INTO #__content (title, introtext) VALUES ('$potato','$potato1')";

$db->setQuery($query);

$db->execute();

break;

}

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

}

?>

<form method="post"action="<?php echo $_SERVER['PHP_SELF'];?>" >

<input type="text" name="mouse">

<input type="hidden" name="refresh" value="refresh" id="refresh">

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

</form>




//THE ERROR PAGE (reloads wrongly)

Get a Book for SEBLOD
4229 Posts
Kadministrator
7 years ago
0
Level 1

I hope you are not using this code on public server as it is very dangerous, you are not using any filtering and escaping before you insert data into database.

Regarding your problems, my answer would be:  use Seblod form field.

Get a Book for SEBLOD