-
Posts
332 -
Joined
-
Last visited
Everything posted by sasori
-
hello, i need help on how to insert my selected option from the drop down menu into the db. the objective is, to allow the user to choose an option from 1-10 based on the skills. here's my code (kindly check if am on the right path of my code and help me how to insert it on db) <tr> <td>1.) Web page creation using WordPress or another HTML editor, please select which one you use and your skill level.</td> <td><select name="webpage"> <?php for($i=10;$i>0;$i--){ echo "<option value='$i'"; if(isset($i)){ echo " selected "; } echo ">$i</option>\n"; } ?> </select></td> </tr> <tr> <td><br>2.) Video Editing?</td> <td><select name="video"> <?php for($i=10;$i>0;$i--){ echo "<option value='$i'"; if(isset($i)){ echo " selected "; } echo ">$i</option>\n"; } ?> </select></td> </tr> <tr> <td><br>3.) Story creation and creativity in producing </td> <td><select name="story"> <?php for($i=10;$i>0;$i--){ echo "<option value='$i'"; if(isset($i)){ echo " selected "; } echo ">$i</option>\n"; } ?> </select></td> </tr> <tr>
-
hello, i created a first page with a number of simple input forms and at the bottom contains the submit button. I created a second page containing the processing code to input in database. the problem now is, after filling up the forms and click the submit button, the browser says, Access forbidden! You don't have permission to access the requested object. It is either read-protected or not readable by the server. If you think this is a server error, please contact the webmaster. Error 403 localhost 01/01/09 18:10:46 Apache/2.2.9 (Win32) DAV/2 mod_ssl/2.2.9 OpenSSL/0.9.8i mod_autoindex_color PHP/5.2.6 i don't know what to do. both the files are stored in same directory inside my xampp. why is it forbidden please help
-
yes sir, am refering to the manual. thanks for the enlightenment
-
am just confuse on why are the methods inside the ReflectionFunction class are declared with datatypes? i thought in PHP, there's no need to indicate datatypes unlike in java and etc.. why is that?
-
let's say we need to validate a password by retyping it in a second form, how am i gonna do that in a model? i ended up copying a function script from someone's work as function validConfirm ($data, $compare) { foreach ($data as $field => $value) { } $compare = $this->data[$this->alias][$compare[0]]; return (Security::hash($value, null, true) === $compare); } and my validation ended up as var $validate = array( 'password' => array( 'modelValidateAccountPasswordStrength' => array('rule' => array('strengthCheck', 'password')), 'modelValidateAccountPasswordLength' => array('rule' => array('minLength', '7')), 'modelValidateNotEmpty' => array('rule' => VALID_NOT_EMPTY) ), 'password2' => array( 'rule' => array('validConfirm','password'), 'message' => 'password not equal') ); but there's an error, the 2nd password field says not match even if the passwords matched and also there's an error with that function that i copied, the $compare[0] it says "notice undefined p" because of the letter "p" in the label .. i read the manual and api and I saw this "equalTo" property, but I don't know how to use it, it doesn't do what i wanted to happen in the process
-
its a cake framework sir here's the "i think" code of the recipient text box // autocomplete $formMailCompose .= $html->div('input text floatLeft', '<label for="Accounts/name">To</label>' . $ajax->autoComplete('_Account_', 'autocomplete', array( 'afterUpdateElement' => 'updateHidden', 'style' => 'width: 410px; margin-left: 30px;' ) )); // target_id $formMailCompose .= $form->hidden('target_account_id', array( 'id' => 'target_account_id' )); so how am i gonna insert or make the dropdown menu to make it appear like To Username: "dropdown here" instead of To Username: "input box here"
-
help, how am I gonna insert or make the "To Recipient" form into a dropdown menu of the contacts usersname in the database?
-
can anyone tell me on how to change security salts in cake? i have this error
-
let's say i have a $countryOptions $countryOptions = $dataCountry->find('list', array( 'order' => 'name asc' )); $this->controller->set('countryOptions',$countryOptions); $emailList = $emailAddress->find('list', array( 'conditions' => '`EmailAddress`.`account_id` = '.$this->controller->Common->getSessionAccountId(), 'order' => 'address desc' how am i gonna modify it in order to make let's say canada as the default country of the select form?
-
am a noob and i need help in cake php.. i dont' know how to fix this error here's my codes //task.php <?php class Task extends AppModel{ var $name = 'Task'; } ?> //class TaskController <?php class TasksController extends AppController{ var $name = 'Tasks'; var $helpers = array('Html','FORM'); function index(){ $this->set('tasks',$this->Task->find('all')); } function add(){ if(!empty($this->data)){ $this->Task->create(); if($this->Task->save($this->data)){ $this->Session->setFlash('The Task has been saved'); $this->redirect(array('action'=>'index'),null,true); }else{$this->Session->setFlash('Task not saved. Try again.');} } } } ?> //add.ctp <?php echo $form->create('Task');?> <fieldset> <legend>Add New Task</legend> <?php echo $form->input('title'); echo $form->input('done'); ?> </fieldset> <?php echo $form->end('Add Task');?> //index.ctp <h2>Tasks</h2> <?php if(empty($tasks)): ?> There are no tasks in this list <?php else: ?> <table> <tr> <th>Title</th> <th>Status</th> <th>Modified</th> <th>Actions</th> </tr> <?php foreach($tasks as $task): ?> <tr> <td> <?php echo $task['Task']['title'] ?> </td> <td> <?php if($task['Task']['done']) echo "Done"; else echo "Pending"; ?> </td> <td> <?php echo $task['Task']['created'] ?> </td> <td> <?php echo $task['Task']['modified'] ?> </td> <td> <!-- actions on tasks will be added later --> </td> </tr> <?php endforeach; ?> </table> <?php endif; ?> when i point browser to localhost/cooktoodoo/task/add that screenshot appears
-
thank you very much for the tips.
-
it worked with the <br/> tag..i never thought that is possible. thank sir
-
but sir, the problem is with the data that i input in the database.. its a 3 liner..but when pull it out and output it using PHP,, it produces a single line only
-
i have this problem when outputing the content of my page, here's the screenshot my database contents is this i tried to put "\n" inside the database..and yet nothing happened..it just worsen the output and it output the \n as is
-
hello I have a problem pulling something from database in output it..before i ask my question let me show you the structure and content of my db and my code. //subjects table ,'id','menu_name','position','visible',,, ,'1','About Me','1',1',,, ,'2','Portfolios','2','1',,, ,'3','Services','3','1',,,, //pages table ,'id','subject_id','menu_name','position','visible',,, ,'1','1','Educational Background','1','1',,, ,'2','1','Work Experience','2','1',,, ,'3','1','Skills','3','1',,, ,'4','2','test.com','1','1',,, and here's my code to pull and output <?php $result = mysql_query("SELECT * FROM subjects ORDER BY position ASC",$connection); if(!$result){ die("subject query failed: ". mysql_error()); } while($row = mysql_fetch_array($result)){ echo "<li>{$row["menu_name"]}</li>"; $result = mysql_query("SELECT * FROM pages WHERE subject_id={$row["id"]} ORDER BY position ASC",$connection); echo "<ul>"; while($row = mysql_fetch_array($result)){ echo "<li>{$row["menu_name"]}</li>"; } echo "</ul>"; } ?> here's the screenshot of the output why does my code doesn't output the other 2 subjects and the 4th test.com under the portfolios subject?
-
let's say I have a long text to put in the content field of my table something like "the quick brown fox jumps over the lazy dog near the bank of the river" im confuse..how am i gonna put a new line if i want to make the next set of sentences or phrase ? \n <-- is not allowed in sql right?
-
to Mr. Andy17 and ProjectFear .. thanks for the tips.. it helps alawt
-
im encountering the last error in my script i don't know how to configure it first,here's the db composition ,uid,first_name,user_name,, ,1,peter,spiderman,,, ,2,henry,beast,,, now here's my log-in form script //test1.php <?php if(isset($message)) { echo $message; } echo "<html>\n"; echo "<body>\n"; echo "<form action='$_SERVER[php_SELF]' method='POST' >\n"; echo "<label for ='user_name'>User id</label>\n"; echo "<input type='text' name='user_name' size='20' id='user_name' value='$user_name' />"; echo "<label for ='password'>Password</label>\n"; echo "<input type='text' name='password' size='20' value='$password' />"; echo "<input type='hidden' name='sent' value='yes' />"; echo "<input type='submit' value='login' />"; echo "</form>\n"; echo "</body>\n"; echo "</html>\n"; ?> here's the logic script //logincookie.php <?php if(isset($_POST['sent']) && $_POST['sent'] == "yes") { foreach($_POST as $field => $value) { if(empty($value)) { $blank_array[$field] = $value; } else { $good_data[$field] = strip_tags(trim($value)); } }//end foreach if(sizeof($blank_array) > 0) { $message = "fill up both forms"; extract($blank_array); extract($good_data); include("test1.php"); exit(); } include("db.php"); $cxn = mysqli_connect($host,$user,$pwd,$db) or die ("can't connect"); $query = "SELECT first_name FROM users2 WHERE user_name='$_POST[user_name]' AND pwd=md5('$_POST[password]')"; $result = mysqli_query($cxn,$query) or die ("can't execute query"); $n_row = mysqli_num_rows($result); if($n_row < 1) { $message = "user not found"; extract($_POST); include("test1.php"); exit(); } else { $row = mysqli_fetch_assoc(result); setcookie("first_name",$row['first_name']); setcookie("auth","yes"); header("Location: http://localhost/webapp/test2.php"); } } else { $user_name = " "; $password = " "; include("test1.php"); } ?> and here's the greeting page script //test2.php <?php if($_COOKIE['auth'] != "yes") { header("Location: http://localhost/webapp/logincookie.php"); exit(); } echo "welcome to php {$_COOKIE['first_name']}"; echo "<form action='logincookie.php' method='get'>"; echo "<input type='submit' value='back' />"; echo "</form>\n"; ?> and when i tried to input a db existing username in the form the output only says, Welcome to PHP (it doesn't include the first name that should be welcomed ) ???
-
on what part? you mean like this? setcookie("test_cookie", $value,time(),path,domain) is it ?
-
hello, i just bumped into setting a cookie lesson i tried to run this to my browser <?php $value = "something from somewhere"; setcookie("test cookie",$value,time()+3600,"/webapp/","webapp"); ?> and the error says, Warning: Cookie names can not contain any of the folllowing '=,; \t\r\n\013\014' (Test Cookie) in C:\wamp\www\webapp\setcookie.php on line 3 I don't understand it
-
clear as the mountain springs...thanks sir
-
what i wanted to happen was output a hello greeting to a username that exist in the database if it was logged in the form..but what it currently does is, it outputs the greeting even if you just type a username on the URL ..username doesn't exist in the database
-
i'll take note of that.. am not yet in the sessions stuff from the book am reading that's why i don't have any idea about it
-
i have these 3 scripts //loginform.php <?php if(isset($message)) { echo "$message"; } echo "<form action='$_SERVER[php_SELF]' method='POST'>"; echo "<label for='user_name'>username</label>"; echo "<input type='text' name='user_name' id='user_name' value='$user_name' />"; echo "<label for='password'>password</label>"; echo "<input type='text' name='password' id='password' value='$password' />"; echo "<input type='hidden' name='sent' value='yes' />"; echo "<input type='submit' value='Log in' />"; ?> //login.php <?php if(isset($_POST['sent']) && $_POST['sent'] == "yes") { foreach($_POST as $field => $value) { if(empty($value)) { $blank_array[] = $field; } else { $good_value[$field] = strip_tags(trim($value)); } } //end foreach if(sizeof($blank_array) > 0 ) { echo " you need to enter both userid and password"; extract($good_value); extract($blank_array); include('loginform.php'); exit(); } //end if blanks found include('db.php'); $cxn = mysqli_connect($host,$user,$pwd,$db) or die ("can't connect to db"); $query = "SELECT userid FROM users WHERE userid='$_POST[user_name]' AND pwd=md5('$_POST[password]')"; $result = mysqli_query($cxn,$query) or die("can't execute query"); $n_row = mysqli_num_rows($result); if($n_row < 1) { $message = "User id and password not found!"; extract($_POST); exit(); } else { $row = mysqli_fetch_assoc($result); extract($row); header("Location: http://localhost/webapp/logingreet.php?user_name=$row[userid]"); } } //end submit else { $user_name = ""; $password = ""; include("loginform.php"); } ?> <?php echo "Hello,{$_GET['user_name']}Welcome to the secret page"; ?> when i run the login.php and input a username and password that exist in the database, the logingreet.php just works fine..but i got alarmed when i tried to insert a username on the URL of the logingreet.php?user_name= that doesn't exist in the db..and it worked ..what should i do to fix this?
-
error fixed..i mistyped something on the loginform.php