Hi!,
I'm a little bit new with php and I have a little issue here. I created a webform to insert some infos into a MySQL database. The weird thing is that some of the infos is correctly inserted and some not? I doubled checked my code and can't find what it is since it's a pretty simple code. If anyone can help, it would be really appreciated!
Here the form code :
Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link href="../../css/style1.css" rel="stylesheet" type="text/css" />
<title>LVA ENTERTAINEMENT</title>
</head>
<center>
<br /><br />
<b>Ajout d'un Artiste L.V.A</b>
<form enctype="multipart/form-data" action="processes/insert_artist.php" method="POST" target="main2">
<table cellspacing="0" cellpadding="4" width="550">
<tr>
<td width="275">Nom de l'artiste : </td>
<td width="225"><input type="text" name="artist" class="login" style="width: 250px"></td>
</tr>
<tr>
<td>Label : </td>
<td><input type="text" name="label" class="login" value="L.V.A ENTERTAINMENT" style="width: 250px"></td>
</tr>
<tr>
<td>Site Web : </td>
<td><input type="text" name="website" class="login" style="width: 250px"></td>
</tr>
<tr>
<td>Albums : </td>
<td><input type="text" name="albums" class="login" style="width: 250px"></td>
</tr>
<tr>
<td>Photo 1 :</td>
<td><input type="file" name="uploadedfile" class="login" style="width: 250px"></td>
</tr>
<tr>
<td colspan="2">Biographie :</td>
</tr>
<tr>
<td colspan="2"><textarea style="width: 550px" rows="15" class="login" name="bio"></textarea></td>
</tr>
<tr>
<td colspan="2" height="40" align="right" valign="bottom"><input type="submit" value="Enregsitrer" class="login"></td>
</tr>
</table>
</form>
And now here's the PHP code :
<?php
$target_path = "../artists photo/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
$picture = basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "<center><br /><br />votre photo $picture a été correctement enregistré</center>
";
} else{
echo "<center><br /><br />Il y a eu un problème avec l'instertion de votre photo</center>
";
}
?>
<?php
$con = mysql_connect("server","user","pass");
$artist = mysql_real_escape_string($_POST['artist']);
$label = mysql_real_escape_string($_POST['label']);
$website = mysql_real_escape_string($_POST['website']);
$albums = mysql_real_escape_string($_POST['albums']);
$photo = mysql_real_escape_string($_POST['uploadedfile']);
$bio = mysql_real_escape_string($_POST['bio']);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}mysql_select_db("a1808796_data", $con);$sql="INSERT INTO artists ( artist, label, website, albums, photo, bio)
VALUES
('$artist','$label','website','$albums','$photo','$bio')";if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "<br /><br /><center>Votre artiste a correctement été ajouté à la base de donnée.<br /><br /><a href="panel.php" target="main2">Retour au paneau de contrôle</a></center>";
?>
As you can see I have artist, label, website, albums, photo, bio
the artist, label, albums and bio insterts correctly
"website" always inster "website" instead of the value posted in the form
the uploaded file (wich is a picture file) uploads correctly but the value ($photo) is not inserted into the DB....
If anyone sees the problem please help!!!!!
thanks
creating a 1 to 100 in a table
hi guys I am a newb in php need some help. I have a table with 1 column and 100 rows and in each i want to do a 1-100. Can someone give me the full coding for this, please I can get it to work. I
calculator
I can't figure out why this code doesn't work. No error messages. Page loads.Code: <?php # Script 3.9 - calculator.php$page_title = 'Widget Cost Calculator';include ('./header.html');function
Posting Serialized Data Not Working
I am trying to send an object from one PHP file to another using POST. I serialize the object and then add slashes. For some reason, only part of the data is getting through. It appears to be a
Help me with some material on Open Text Overview.
Hi Experts,
textfield unchanged
hi,i want my form to know whether its textbox is unchange or not.if($textbox == 'unchanged'){ //do this}else{ //do this}ive been searching all day , but cant find the exact solutions...
please hep to get values from a table row
can anyone tel me how I can select and get data from one row by pressing an Edit button in that row?<?phpif (!empty($avil_holidays)){ foreach ($avil_holidays as $val) { switch
Creating an invoice
Using fpdf I am trying to create an invoice to send to clients. The products are sold in pricing tiers.I've got it working so it only displays a tier if the quantity is greater than 0 but I end up
How To Make More Than One Redirection with PHP on the same page?
Hey im trying to do a direction page where it open differently link direction pages every time somebody enter it.. like this for example any good hint on how to do this?<?phpheader(
Need help with a mail notify function
I was tasked with setting up a site that's been prewritten. The site is basically a form that captures user's info on the frontpage. All the code is there except the ability to notify the admin upon
Php Mysql Page Loading Notice
Hi all,I was wondering if there is a way (Sure there is) of showing a message or an image while a page is loading.The issue is that I have a big table and I'm running some queries against it.Obviously