is project_name a VARCHAR if so then you will need quotes around the value
UPDATE projects set project_name='$project_nam
same with the modified field if its a DATETIME type.
Main Topics
Browse All TopicsHi,
I've retreived some values and displayed them in text box like so:
value=<?php echo smart_strip_slashes($proje
I expect these values to be modified and then I want to commit to the db again.
When I run this next code sample I'm not getting any values assign the these varaibles.
I need help capturing text box values into these vars... <$project_name>
TIA
if( 1 == $_POST["update_project"] ) {
$project_name = $_POST["$post_project_name
print "project_name = $post_project_name <br>";
$sql = "UPDATE projects SET
project_name = $project_name,
modified_dt = NOW()
WHERE
project_number = $project_number";
print $sql;
$rs = $db->query($sql);
if( DB::isError($rs) ) {
print "Error with SQL: <br>$sql<br>";
die ($rs->getMessage());
}
}
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi,
I collecting the $project_number from the previous page via a
if( isset($_GET["project_numbe
$project_number = $_GET["project_number"];
which i use to select that project data and display for editing.
I then want to commit any updates, and I'm using this code
<form name="update_project" action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
<input type="hidden" name="update_project" value="1">
<input type="hidden" name="project_number" value="<?php echo $project["project_number"]
<input type="submit" value="Update Project">
</form>
and this....
if( 1 == $_POST["update_project"] ) {
$project_name = $db->quote($_POST["project
print "project_name = $project_name <br>";
}
nevermind the commit, at this point my print statement only shows a NULL
when I run this, I expect the project name retrieved to be printed.
this project_name is a varchar(150),
jkna_gunn thanks for pointing out the string quotes, but they're still comming up NULL.
Any ideas or suggestions.
TIA
tknayak,
yes, it should.
eDias,
> I collecting the $project_number from the previous page
You still need to collect it again on this page from your hidden variable.
> <?php echo $project["project_number"]
is this from an array or a session?
Lastly, mysql_real_escape_string may not work on your php version - you can try mysql_escape_string instead.
try:
<form name="update_project" action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
<input type="hidden" name="update_project" value="1">
<!--// put your project number code in here //-->
<input type="hidden" name="project_number" value="9">
<!--// put your project number code in here //-->
<input tpe="text" name="project_name">
<input type="submit" value="Update Project">
</form>
<?php
$update_project = mysql_escape_string($_POST
$project_name = mysql_escape_string($_POST
$project_number = mysql_escape_string($_POST
if(!empty($project_number)
$sql = "UPDATE projects SET
project_name = '$project_name',
modified_dt = NOW()
WHERE
project_number = $project_number";
print $sql;
}
?>
I think I'm almost there ;-)
if I use this it works fine...
<input tpe="text" name="project_name">
but I need to pass the value of an object called "project_name"
<input type="text" size="43" name="project_name"
value=<?php echo smart_strip_slashes($proje
if I use this, I get no value assigned
<input type="hidden" name="_project_name" value="<?php $_POST["project_name"] ?>">
How do i replace the hardcoded string with the current value of this object.
TIA
no, that would be <?php $newProjectVariableName = smart_strip_slashes($_POST
Call newProjectVariableName whatever you want.
Important: Note the underscore before project_name - the variable in the $_POST[] array will take exactly the same name as the input that created it - so <input name="foo" will populate $_POST["foo"]. In PHP this is also case sensitive.
Mike
Business Accounts
Answer for Membership
by: fruglePosted on 2004-12-20 at 15:56:50ID: 12871788
$project_name = $_POST["$post_project_name "];
_POST["$po st_project _name"]); _POST["$po st_project _number"]) ;
...
WHERE
project_number = $project_number";
Where do you assign $project_number?
also, try:
$project_name = mysql_real_escape_string($
$project_number = mysql_real_escape_string($
This will reduce the likelyhood of anyone sending nasty data to your MySQL string.
Mike