hi
i have a dynamic form. i need help in how can i use update query when values from dynamic form get pass to php file.
currently when i press submit it displays this and does not update fields
Code: UPDATE contacts SET name='Array', im='Array' WHERE userid='1'
this my code for dynamic form
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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="lib/jquery-1.4.min(Production).js"></script>
<script>
var id = 0;
function addFormField() {
//document.getElementById("id").value;
id++;
$("#divTxt").append(
"<p id='row" + id + "'><label>Relation <select name='relation[]' id='relation" + id + "'><option value='brother'>Brother</option><option value='sister'>Sister</option><option value='father'>Father</option><option value='mother'>Mother</option></select> <input type='text' name='name[]' /> <a href='#' onClick='removeFormField("#row" + id + ""); return false;'>Remove</a></p>"
);
}
function removeFormField(id) {
$(id).remove();
}
</script>
</head>
<body>
<form action="addDynamicFields.php" method="post" id="form1">
<label>Relation</label>
<select name="relation[]" id="relation0">
<option value="brother">Brother</option>
<option value="sister">Sister</option>
<option value="mother">Mother</option>
<option value="father">Father</option>
<option value="daughter">Daughter</option>
<option value="son">Son</option>
</select>
<input type="text" name="name[]" />
<div id="divTxt"></div>
<p><input type="submit" value="Submit" name="submit">
<!-- <input type="reset" value="Reset" name="reset"> --></p>
</form>
<p><a href="#" onClick="addFormField(); return false;">Add</a></p>
</body>
</html>
this is my php file
Code: <?php
$screenname = $_POST['relation'];
$name = $_POST['name'];
$connect = mysql_connect("localhost","user","pass");
mysql_select_db("test");
for($i=1; $i<count($screenname); $i++) {
//$imscreenname = $_POST['screenname'][$i];
//$imname = $_POST['name'][$i];
//echo $imscreename;
//$imscreenname = $screenname[$i];
$screennamesave = "UPDATE contacts SET name='$screenname', im='$name' WHERE userid='1'" or die(mysql_error());
$result = mysql_query($screennamesave);
echo $screennamesave;
}
?>
help, header() is not working!
Hello, I have this code:<?php/** * @author samoi * @copyright 2009 */error_reporting(E_ALL & E_NOTICE);include ('func.php'); // this has the session_start() func!if
understanding functions and classes
Code: [Select]class person { var $name = "Jimmy Goe"; function get_name(){ echo $this->name; }} I am playing with this very small script that I made using a
Displaying Multidimensional Arrays...about to put my head in a vice, PLEASE HELP
I am fairly new to PHP and MySQL and I have a problem which I have been trying to resolve for days. I just can't figure it out and can't find anything on the web that is helping me work it out.I hope
Appending GET data with form submition
Okay, what I'm trying to do is to use a form to append an already existing GET data string.It goes something like this:REQUEST_URI="/page.php?var1=foo&var2=bar"Now, what I want to do
Array to string conversion
Can anyone help me with this?Notice: Array to string conversion in /home/..../index.php on line 360Whatever this is, it's causing the script to fail at uploading.Code (starting just before line
Google voice
I currently have a form in html, but I want it in php so the information is not in the source code.It all works and when you put in the name and number it will call. When you push the call button it
Having a problem get the selected item from a drop down menu
I have been looking at this for days now.I have a drop down menu that get it's values from an sql database That works but now I want to get the item and pass it to another query that's where I get
Giving the below syntax error
Dear Experts,
phpMailer will not connect using SMTP
I am trying to use phpMailer with smtp:Code: [Select]$mailer = new PHPMailer();$mailer->IsSMTP();$mailer->Mailer = "smtp";$mailer->SMTPSecure = 'tls';
Firewall / visited websites logger
Hi.