Jump to content

How to store html code into mysql table then use it.


webznz

Recommended Posts

I have been trying to find out how to store html code into a mysql table then later use it on another page.

I have a form where the user can input products lets say for a car. one of the fields is for embedded Picasa slide show code.

 

here is the form for inserting:

<!-- controll panel start here -->
<form method="post" action="php/update.php">

	Item Type:</br>
	<input type="text" name="Name" size="25" /></br></br>

	Modle:</br>
	<input type="text" name="ModelName" size="25" /></br></br>

	Description:</br>
	<textarea rows="10" cols="20" wrap="physical" name="Description">
	</textarea></br>

	Slideshow:</br>
	<textarea rows="10" cols="20" wrap="physical" name="SlideShow">
	</textarea></br>

	Price:</br>
	<input type="text" name="Price" size="25" /></br></br>

	<input type="submit" value="Update Database" />

</form>
<!--controllpanel links start here -->

 

once update database is clicked the information in the text fields are then sent to update.php

which is here:

<?php
$Name =$_POST['Name'];
$ModelName =$_POST['ModelName'];
$Description =$_POST['Description'];
$SlideShow =$_POST['SlideShow'];
$Price =$_POST['Price'];

mysql_connect ("localhost", "root", "onlyiknow") or die ('Error: ' . mysql_error());
mysql_select_db ("mtsproducts");

$query="INSERT products (Name, ModelName, Description, SlideShow, Price)VALUES ('".$Name."', '".$ModelName."', '".$Description."', '".$SlideShow."', '".$Price."')";

mysql_query($query) or die ('Error updating database');

echo "1 entry entered" .$Name. " " .$ModelName. " " .$Description. " " . htmlspecialchars($SlideShow) . " " .$Price ;


?>

 

The questions I have are

- Am i storing the embedded code correctly into the mysql SlideShow column?

- How do i later use/call this code so it shows my picasa slideshow on a different page?

 

any suggestions would be much appreciated.

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.