Jump to content

poqoz-87

Members
  • Posts

    28
  • Joined

  • Last visited

    Never

Everything posted by poqoz-87

  1. i m learning how to have session in my form. like for example, after the user insert their information in the application form, they will then be redirected to another page. the another page is where they will have to print out their form - with their info added in. but i m unsure how to go about doing it. can someone show me?
  2. should the session.save_path has the same directory path as the extension_dir?
  3. i have tried using this php code example for session. the php code that i am using is this: i get this code at this website: http://www.tizag.com/phpT/phpsessions.php <?php session_start(); $_SESSION['views'] = 1; // store session data echo "Pageviews = ". $_SESSION['views']; //retrieve data ?> the output supposedly should just has Pageviews = 1. but i receive this error. the error that i get is this: PHP Warning: session_start() [function.session-start]: No such file or directory (2) in Unknown on line 0 PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (C:/ <the path name of the folder>) in Unknown on line 0. what does this error means n how can i solve this error?
  4. i has already solve the problem it lies in the javascript validation code
  5. its looks very weird. i can insert the user information into the database, but when i add in some javascript code to validate (for example, if the user forgot to enter their first name, there will be a pop-up error message), i cannot insert the user information into the database. and vice-versa. if i can validate, i cannot insert the information into the ms sql database. i dunno what went wrong. can someone shine the light here?
  6. i m trying to validate radiobutton n checkbox but to no avail. this is the code that i m currently using in validating the radiobutton <script language="JavaScript"> function checkForm() { var cgender with(window.document.msg) { cgender = gender; } if(trim(cgender.value) == '') { alert('Please select ur gender); cgender.focus(); return false; } else { cgender.value = trim(cgender.value); </script> <form name="msg" id="msg"> Gender: <input name="gender" type="radio" value="male" /> Male <input name="gender" type="radio" value="female" /> Female <input type="submit" name="submit" value="Submit"onClick="return checkForm();"> i have try using the above code to validate my radiobutton but it does not work at all. can someone tell me what went wrong in my code n also, how to validate check box n dropdown list?
  7. i has this idea in mind but it cant seem to work. i m using ms sql database, by the way:) this is the scenario: the user will have to fill in the membership form. when they click onto the submit button in the membership form, the information-that the user key in, will be displayed in the next page. this is the code that i am using to display the info-that the user key in to be display onto the next page <form action="action.php" method="get"> <p>Your name: <input type="text" name="name" /></p> <p>your age: <input type="text" name="age" /></p> <p><input type="submit" /></p> Hi <?php echo htmlspecialchars($_GET['name']); ?>. You are <?php echo (int)$_GET['age']; ?> years old and this is the thing that until now, i finding difficulty with. in the action.php page, the user will then have to click onto the submit button in order for their information to be inserted in the ms sql database. can someone help me as in, how am i suppposed to get the info-that the user key in from the action.php page,to be inserted in the ms sql database?
  8. is it possible to have an image in an echo statement? this is my echo statement >> echo("<br/><br/><br/><fieldset><legend>Success!</legend><br/>Your application form has been successfully stored in our database.</fieldset>"); i want to put an image in the echo statement. i have tried using <img src="Desktop/pictures.is.best/scs.jpg" width="176" height="83" /> in the echo statement, but still, there are no image in the browser. can someone tell me how can i insert an image in the echo statement?
  9. thank you. it work now-after i change E-ALL to E-WARNING in the php.ini.
  10. can someone tell me what does this error means? n how can i solve it? this the error that i m referring to: PHP Notice: Undefined index: gender in C:\Inetpub\wwwroot\done-all-de-steps\Untitled-6-1n2n3n4nbannern7err.php on line 112
  11. oopss. sorry. i m using php document and the database that i am using is ms sql database. i can connect the php document to the ms sql database. the codes that i am using to connect the php doc to the database is this: <?php if (!empty($_POST["submit"])) { $conn = mssql_connect("<my ip address>", "<my user name>", "<my pwd>"); mssql_select_db("lalalalalala", $conn); $sql = "INSERT INTO Hello (fname,lname)VALUES ("; $sql .= "'" . $_POST["fname"] . "', "; $sql .= "'" . $_POST["lname"] . "')"; mssql_query($sql, $conn); mssql_close($conn); echo("<p>Entry added to database!</p>"); } ?> what i am now trying to do is to validate both of these two fields(fname & lname), when the user clicks onto the submit button. can someone give me an example of code on how to validate both of these two fields?
  12. i can insert the fields into the ms sql database. what i am now trying to do is to validate the fields in the document. i have tried validating the fields, but then later, i cannot insert the data into the database. can someone show me an example of how to validate fields in a document?
  13. haven yet finish. why issit when i want to add label called "gender", the data is not being inserted to the ms sql database? there is no error. its just that the data is not being inserted into the ms sql database. this is the codes that i m using now: <?php if (!empty($_POST["submit"])) { $conn = mssql_connect("<my ip address>", "mei", "mei"); mssql_select_db("lalalala", $conn); $sql = "INSERT INTO users (name, email,residence,Gender) VALUES ("; $sql .= "'" . $_POST["name"] . "', "; $sql .= "'" . $_POST["email"] . "', "; $sql .= "'" . $_POST["residence"] . "', "; $sql .= "'" . $_POST["Gender"] . "')"; mssql_query($sql, $conn); mssql_close($conn); echo("<p>Entry added to database!</p>"); } ?> <form method="post"> Name: <input type="text" name="name" /><br /> Email: <input type="text" name="email" /><br /> Residence: <input type="text" name="residence" /><br /> Gender: <input name="Gender" type="radio" value="" /><label>Male</label> <input name="Gender" type="radio" value="" /><label>FeMale</label><br /> <input type="submit" name="submit" value="Add to database" /> </form> i have tried using the codes, that u-mmarif4u send it to me, but to no avail. can someone help out?
  14. i have solve the error:) i change this line n it works: $sql = "INSERT INTO users (name, email,residence) VALUES ("; $sql .= "'" . $_POST["name"] . "', "; $sql .= "'" . $_POST["email"] . "', "; $sql .= "'" . $_POST["residence"] . "')"; i can now insert the data into ms sql database. thanks mmarif4u! you have been helping me a lot of time! i really treasure that. thanks so much!
  15. it still resulted in an error. the error is >> PHP Parse error: syntax error, unexpected $end in C:\Inetpub\wwwroot\insert-1.php on line 40 the weird thing is that on line 40, it is </html>. what is wrong? <?php if (!empty($_POST["submit"])) { $conn = mssql_pconnect("<my ip address>", "mei", "mei"); mssql_select_db("lalalala", $conn); $username=htmlentities($_POST['name']); $email=htmlentities($_POST['email']); $resid=htmlentities($_POST['residence']); $sql = "INSERT into `users` SET "; $sql .= "`name` = ('" . $username . "'), "; $sql .= "`email` = ('" . $email . "'), "; $sql .= "`residence` = ('" . $resid . "') "; $sql_result = mssql_query($sql, $conn); mssql_close($conn); if($sql_result){ echo "<p>Entry added to database!</p>"; } ?> <form method="post"> Name: <input type="text" name="name" /><br /> Email: <input type="text" name="email" /><br /> Residence: <input type="text" name="residence" /><br /> <input type="submit" name="submit" value="Add to database" /> </form> </body> //this is line 40 </html>
  16. it still resulted error. the error is this >> PHP Warning: mssql_query() [function.mssql-query]: message: Line 1: Incorrect syntax near '`'. (severity 15) in C:\Inetpub\wwwroot\insert-1.php on line 27 PHP Warning: mssql_query() [function.mssql-query]: Query failed in C:\Inetpub\wwwroot\insert-1.php on line 27 . //the line 27 which has caused the error $sql_result = mssql_query($sql, $conn); what should i do?
  17. there is still an error. the error is >>> PHP Warning: mssql_query() [function.mssql-query]: message: Line 1: Incorrect syntax near '`'. (severity 15) in C:\Inetpub\wwwroot\insert-1.php on line 27 PHP Warning: mssql_query() [function.mssql-query]: Query failed in C:\Inetpub\wwwroot\insert-1.php on line 27 //line 27 are the line which has cause the error $sql_result = mssql_query($sql, $conn); how can i solve this error?
  18. ok. i have tried using ur code. but there is still an error. the error is: PHP Warning: mssql_query() [function.mssql-query]: message: Line 1: Incorrect syntax near '`'. (severity 15) in C:\Inetpub\wwwroot\insert-1.php on line 27 PHP Warning: mssql_query() [function.mssql-query]: Query failed in C:\Inetpub\wwwroot\insert-1.php on line 27 what should i do? how can i solve this error?? this is driving me nuts! this is the codes that i use together with the codes that u told me: <?php if (!empty($_POST["submit"])) { $conn = mssql_connect("<my ip address>", "mei", "mei"); mssql_select_db("lalalala", $conn); $username=htmlentities($_POST['name']); $email=htmlentities($_POST['email']); $resid=htmlentities($_POST['residence']); $sql = "INSERT into `me` SET "; $sql .= "`name` = ('" . $username . "'), "; $sql .= "`email` = ('" . $email . "'), "; $sql .= "`residence` = ('" . $resid . "') "; //line 27 mssql_query($sql, $conn); mssql_close($conn); echo("<p>Entry added to database!</p>"); }
  19. i am inserting user input into ms sql database, by the way:) i have tried using ur code. but there is still an error. the error is PHP Fatal error: Call to undefined function mysql_real_escape_string() in C:\Inetpub\wwwroot\insert-1.php on line 17 what should i do ? this are the codes that i m talking abt: <?php if (!empty($_POST["submit"])) { $conn = mssql_connect("<my server ip address>", "mei", "mei"); mssql_select_db("lalalala", $conn); $username=mysql_real_escape_string($_POST['name']); $email=mysql_real_escape_string($_POST['email']); $resid=mysql_real_escape_string($_POST['residence']); $sql = "INSERT into `me` SET "; $sql .= "`name` = ('" . $username . "'), "; $sql .= "`email` = ('" . $email . "'), "; $sql .= "`residence` = ('" . $resid . "') "; mssql_query($sql, $conn); mssql_close($conn); echo("<p>Entry added to database!</p>"); }
  20. i have tried another method. i found this code at this website:>> http://www.samag.com/documents/s=9370/sam0210c/0210c.htm the codes that i m working by following the website example is working. but when i try to add new label called "residence", i was given an error. this is the error: PHP Warning: mssql_query() [function.mssql-query]: message: There are more columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement. (severity 15) in C:\Inetpub\wwwroot\insert-1.php on line 20 PHP Warning: mssql_query() [function.mssql-query]: Query failed in C:\Inetpub\wwwroot\insert-1.php on line 20 why is it so?n how can i solve it? this are the codes i used when i try to add new label called "residence" <?php if (!empty($_POST["submit"])) { $conn = mssql_connect("<my server ip address>", "mei", "mei"); mssql_select_db("lalalala", $conn); $sql = "INSERT INTO me (name, email, residence) VALUES ("; $sql .= "'" . $_POST["name"] . "', "; $sql .= "'" . $_POST["email"] . "')"; $sql .= "'" . $_POST["residence"] . "')"; mssql_query($sql, $conn); mssql_close($conn); echo("<p>Entry added to database!</p>"); } ?> can someone help me with this error??
  21. i have tried to insert user input into ms sql database but still unable to do so. my code has no errors in it. its just that the user input cannot be submitted into the ms sql database. can someone help me out with this?? these are the codes that i m using: <?php <?php if (isset($_POST['submit'])) { //Collect form data and assign to scalar variables $Name = $_POST['Name']; $Email = $_POST['Email']; $Connection = $_POST['Connection']; $Residence = $_POST['Residence']; $Age = $_POST['Age']; $Gender = $_POST['Gender']; $Comments = $_POST['Comments']; //Establish a connection to the Database // create connection $connection = mssql_connect("localhost","sa","sa"); // select database $db = mssql_select_db("Hello", $connection); //SQL Statement $sql = "INSERT INTO Survey ". "(Name,Email,Connection,Residence,Age,Gender,Comments) VALUES ('$Name', '$Email', '$Connection', '$Residence', '$Age', '$Gender', '$Comments')"; //Execute SQL Statement and store results as a recordset $rs = mssql_query($db,$sql); //mssql_free_result($rs); mssql_close($connection); } ?>
  22. thanks people for the help! there are no more errors. but now, i cannot insert the user input into the ms sql database.
  23. what do u mean? i dont understand. can give me the example of the code?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.