Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to input php to xml?

Status
Not open for further replies.

C0FFEE123

Programmer
Sep 1, 2008
44
NL
Hello,

I am working with php and xml atm.
I want to put the input the text that i have inputted into a form into xml.
A form sends information to php that sends it to a map and a database.
Now i want to send the information to a xml file.
Because i use the xml file to get pictures + information to put in a flash file.

Anyone has any idea to do it?

PHP code:
Code:
<?php
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
ini_set('error_reporting', 8191);
ini_set('docref_root', '[URL unfurl="true"]http://www.php.net/');[/URL]
ini_set('date.timezone', 'Europe/Amsterdam');
//echo $_POST;


//includes
include_once '../includes/db.inc.php';
include_once 'admin.inc.php';

//functies
check_login();
top_admin('prijzen', $pagina_titel);	
open_db();

//Get the file out of the form that was sended
$uploadedfile = $_FILES['plaatje']['tmp_name'];

$src = imagecreatefromjpeg($uploadedfile);

list($width,$height)=getimagesize($uploadedfile);


//Creates new width and height for the picture
$newwidth=60;
$newheight=80;
$tmp=imagecreatetruecolor($newwidth,$newheight);


imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);

$original_filename = "../occasions/fotos_small/".$_FILES['plaatje']['name'];
$new_filename = trim( strtolower( $original_filename ), 'jpg' ) . 'png'; 
 
//preg_match('~/(:<png_file>.+\.png)$~', $new_filename, $matches);
//$naam_plaatje = str_ireplace('.jpg', '.png', $_FILES['plaatje']['name');
$array = explode('/', $new_filename);
$last = end($array);
$sql="INSERT INTO prijzen (Omschrijving, omschrijving1, omschrijving2, dagprijs, foto)
VALUES
('$_POST[artikel]', '$_POST[korte_omschrijving]', '$_POST[uitgebreide_omschrijving]', '$_POST[prijs]', '" . $last . "')";

//echo '<pre>' . print_r($matches, true) . '</pre>';
//echo $sql . "<br />" . "<br />";
mysql_query($sql);

//$filename = "../occasions/fotos_small/". $_FILES[plaatje][name];
imagepng($tmp,$new_filename,9);
//$filename2 = "../occasions/fotos_medium/". $_FILES[plaatje_m][name];

imagedestroy($src);
imagedestroy($tmp); 

//if (isset($_FILES['plaatje'])){
//  writetofolder('../occasions/fotos_small');
//}
//
//if (isset($_FILES['plaatje_m'])){
//  writetofolder2('../occasions/fotos_medium');
//}
//function writetofolder($foldername){
// if (!is_file($_FILES['plaatje']['tmp_name'])) return false;
// $f = copy ($_FILES['plaatje']['tmp_name'], $foldername . '/'.$_FILES['plaatje']['name']);
// return $f;
//}
//function writetofolder2($foldername){
// if (!is_file($_FILES['plaatje_m']['tmp_name'])) return false;
// $f = copy ($_FILES['plaatje_m']['tmp_name'], $foldername . '/'.$_FILES['plaatje_m']['name']);
// return $f;
//}

echo '<table>';
echo '<tr>';
echo '<tr>';
echo '<td>';
echo "Auto:";
echo '</td>';
echo '<td>';
echo $_POST['artikel'];
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td>';
echo "Korte omschrijving:";
echo '</td>';
echo '<td>';
echo $_POST['korte_omschrijving'];
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td>';
echo "Uitgebreide omschrijving:";
echo '</td>';
echo '<td>';
echo $_POST['uitgebreide_omschrijving'];
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td>';
echo "Prijs:";
echo '</td>';
echo '<td>';
echo $_POST['prijs'];
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td>';
echo "Plaatje:";
echo '</td>';
echo '<td>';
echo $last;
echo '</td>';
echo '</tr>';
echo '</table>';
/*echo "Artikel:"						."&nbsp; "	.$_POST['artikel'] 						. "<br />";
echo "Korte omschrijving:"			."&nbsp; "	.$_POST['korte_omschrijving']			. "<br />";
echo "Uitgebreide omschrijving:"	."&nbsp; "	.$_POST['uitgebreide_omschrijving']		. "<br />";
echo "Prijs:"						."&nbsp; "	.$_POST['prijs']						. "<br />";
echo "Plaatje:"						."&nbsp; "	.$last									. "<br />";
echo "Plaatje groot:"				."&nbsp; "	.$last2									. "<br />";*/

?>
XML code:
Code:
<?xml version="1.0" encoding="utf-8"?>
<icons>
<icon image="test.png" tooltip="a" link="[URL unfurl="true"]http://tvents.nl/events/event-netwerk023-borrel-25-maart-2008/"[/URL] target="_self"/>
<icon image="test.png" tooltip="b" link="[URL unfurl="true"]http://tvents.nl/events/event-netwerk023-borrel-15-april-2008/"[/URL] target="_parent"/>
<icon image="test.png" tooltip="c" link="[URL unfurl="true"]http://tvents.nl/events/serious-gaming"[/URL] target="_parent"/>
<icon image="test.png" tooltip="d" link="[URL unfurl="true"]http://tvents.nl/events/ccc/"[/URL] target="_parent"/>
<icon image="test.png" tooltip="e" link="[URL unfurl="true"]http://tvents.nl/events/event-cross-media-cafe/"[/URL] target="_parent"/>
<icon image="test.png" tooltip="f" link="[URL unfurl="true"]http://tvents.nl/events/event-immovator-crossmedia-cafe-13-mei-2008/"[/URL] target="_parent"/>
<icon image="test.png" tooltip="g" link="[URL unfurl="true"]http://tvents.nl/events/picnic-2007/"[/URL] target="_parent"/>
<icon image="test.png" tooltip="g" link="[URL unfurl="true"]http://tvents.nl/events/event-nederlandse-game-dagen/"[/URL] target="_parent"/>
</icons>

-------------------------------------
I am a progammer.... no realy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top