kathir
-
Posts
9 -
Joined
-
Last visited
Posts posted by kathir
-
-
Classes don't really work that way in terms of the direct return statement.
Your class should look more like this:
class tempclass { public $val1; function __construct($my_var) { $this->val1 = $my_var+5; } }
but really it looks like you want a function more than a class
function my_func($my_var) { return $my_var+5; }
wow..Thanks a lot.. am a new bee and it helps me a lot...
-
no one solved it for me..
-
Turn on error checking.
i did it..but no change..
-
Hello Frieds,
I have problem with simple class in php. Please Help.
This is my form code.
<form name="form1" action="ex1_exec.php" method="POST" /> <input type="text" name="val1" /> <input type="submit" name="submit" value="Submit" /> </form>
and,
the ex1_exec.php file code is,
<?php public $val1=$_POST['val1']; class tempclass { return $this->val1+5; } $obj=new tempclass($val1); echo $obj->val1; ?>
When try to run those codes, i get only empty page.
Please Help for this problem.
-
Hello Friends, Please Help. The following the code for simple post method using session. Please read the codes.
page1.php
<?php session_start(); if(isset($_POST['seat'])) { $seat=$_POST['seat']; if (isset($_SESSION['seat'])) { if ($_SESSION['seat'] == "") { $_SESSION['seat']=$_POST['seat']; } else { $_SESSION['seat'] .=",".$_SESSION['seat']; } } else { $_SESSION['seat']=$_POST['seat']; } } ?> <html> <body> <form name="form1" action="<?php $_PHP_SELF; ?>" method="POST"> Select No. Of Seats: <select name="seat"> <option value=""></option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> <input type="submit" name="submit" value="Book Now" /> </form> <a href = "newpage.php">Results</a> </body> </html>
->In Page1.php i was selected the options one by one and clicked the submit. After that i was clicked the 'Results' link which redirect to newpage.php.
newpage.php
<?php session_start(); if(isset($_SESSION['seat'])) { $seat1=explode(",",$_SESSION['seat']); foreach($seat1 as $stt) { echo $stt."<br>"; } } session_destroy(); ?>
->In newpage.php, the actual result should be 1 2 3 4 5. But i get only the first result like 1 1 1 1 1.
Please help me, what i did a mistake in the coding...???
-
Make sure that you don't have any whitespace above the opening php tag.
Also how are you attempting to run this script? Are you using http://localhost/yourscript.php?
Yes i used to run the script with http://localhost/yourscript.php . Now its solved. Thanks for your kind reply.
-
What is happening? Are you getting any errors?
It displays empty page. But now its solved. Thanks for you kind reply..
-
Dear Friends, Simple header in php not working. I'm Using XAMPP 1.8.2, PHP 5.4.22.
I dont know this simple header function not working. Please HELPPPP..
I have already tried the following codes.
<?php header('Location:http://www.google.com'); ?>
Is there any other problems with php.ini file or something?. Please i need help.
Enable error reporting in php..Helppp?
in PHP Coding Help
Posted
Hello Friends,
I'm using xampp 1.8.2 for my php. When i try to run my php scripts, it shows only empty pages. Its too difficult for me to find my errors in the script. Please tell me how do i enable error reporting manualy in php. thank you.