sakarora
-
Posts
3 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Downloads
Gallery
Store
Posts posted by sakarora
-
-
The point of the is_numeric() line is to ensure that someone isn't trying to mess with the website by inputting code into the URL. However, if the value you are expecting in the URL that you are using isn't numeric, then you will need to remove that if statement.
Hi Ben,
THANKS FOR YOUR REPLY...
what and how much portion is to be removed?? plz be specific... i am newbie... when i remove if loop it gives me blank page when i click on edit.... or tell me what is to be written in place of is_numeric... if i want user to be enter characters only..
P.S i removed
if (isset($_POST['submit']))
{
// confirm that the 'id' value is a valid integer before getting the form data
if (is_string($_POST['signum']))
{
// get form data, making sure it is valid
$signum =$_POST['signum'];
$name = mysql_real_escape_string(htmlspecialchars($_POST['name']));
$emp_id = mysql_real_escape_string(htmlspecialchars($_POST['emp_id']));
// check that firstname/lastname fields are both filled in
if ($name == '' || $emp_id == '')
{
// generate error message
$error = 'ERROR: Please fill in all required fields!';
//error, display form
renderForm($signum, $name, $emp_id, $error);
}
else
{
// save the data to the database
mysql_query("UPDATE EMP SET name='$name', emp_id='$emp_id' WHERE signum='$signum'")
or die(mysql_error());
// once saved, redirect back to the view page
header("Location: view.php");
}
}
else
{
// if the 'id' isn't valid, display an error
echo 'Error!';
}
}
PLEASE EDIT THE SCRIPT FOR ME AND PASTE IT OVER HERE IF POSSIBLE...
-
hi admin..
i used the script you provided for editing.. first of all thanks for the lovely script..
i created a table with id,firstname and lastname fields..as u told and it went perfect with no error... but i tried it for another table and fields 'signum' in place of 'id'.. and it gave me error because signum is varchar type... and id is int... if i keep signum as int then it works fine but gives error for varchar.... there's a line in edit.php which checks that input is_numeric... what to write inplace of that... please provide me with that script...i urgently need it.... THANKS IN ADVANCE...
Basic Php System: View/edit/delete/add Records
in PHP
Posted
Thankyou Thankyou Thankyou... i am done with it.. thanks alot Ben... :*