problem with page redirect and data insertion together | Member | | Join Date: Sep 2007
Posts: 45
| |
Hi all,
i m having a problem with inserting data in oracle db.
When i use form action =(call self page) then data is inserting properly.But problem with when using form action=(Another_page).data is not insering into database.For ur kind infromation i m using oracle db and php for my application.
sample code: -
<form action="welcome.php" method="post">
-
Name: <input type="text" name="name" />
-
Age: <input type="text" name="age" />
-
<input type="submit" />
-
</form>
pls can any one help me.
Thanks
| | Lives Here | | Join Date: Sep 2006
Posts: 12,070
| | | re: problem with page redirect and data insertion together
In which page is the code that inserts the values in the database? That's the one you have to call if you want the values to be inserted.
| | Member | | Join Date: Sep 2007
Posts: 45
| | | re: problem with page redirect and data insertion together
hi,
Thanks for reply.
My fisrt page is "test.php" from where i m trying to insert data
After press on submit button form data will store in db and a success massege will show on the "wlcome.php"page. -
<html>
-
<body><form action="welcome.php" method="post">
-
Name: <input type="text" name="name" />
-
Age: <input type="text" name="age" />
-
<input type="submit" />
-
</form></body>
-
</html>
so pls help me how to divert the page to "wlcome.php" as well as data will insert in to db.
Thanks
| | Lives Here | | Join Date: Sep 2006
Posts: 12,070
| | | re: problem with page redirect and data insertion together | | Member | | Join Date: Sep 2007
Posts: 45
| | | re: problem with page redirect and data insertion together
hi,
Thanks for ur cooperation.
it willbe help for me if u make it clear in my given example for how to use "header"to redirect the page into welcome.php.
thanks again
| | Member | | Join Date: Sep 2007
Posts: 45
| | | re: problem with page redirect and data insertion together
hei,
i need ur help wthh my specified problem previously disscussed.
it's urgent for me so, pls help me.
Thanks
| | Member | | Join Date: Sep 2007
Posts: 45
| | | re: problem with page redirect and data insertion together
Hi all,
i m having a problem with inserting data in oracle db.
When i use form action =(call self page) then data is inserting properly.But problem with when using form action=(Another_page).data is not insering into database.For ur kind infromation i m using oracle db and php for my application.
sample code: -
<form action="welcome.php" method="post">
-
Name: <input type="text" name="name" />
-
Age: <input type="text" name="age" />
-
<input type="submit" />
-
</form>
the above code not data inserting but page is redirecting.
so how to insert data aswell as redirect the page in welcome.php ?
pls can any one help me.
Thanks
|  | Moderator | | Join Date: Jun 2007 Location: York, England, with wolves.
Posts: 4,948
| | | re: problem with page redirect and data insertion together
Show the code you use to insert on welcome.php
|  | Member | | Join Date: Sep 2007
Posts: 33
| | | re: problem with page redirect and data insertion together
hi......
1. U R getting some error ...... for page not found.... if yes write the proper action for form...
2. check weather ur getting all ur required data for ur query...... by echoing or printing the data.....
3. check ur query with the database...
4. using PHP_SELF is better than using form action.....
5. if none of the above then paste ur code.....
|  | Moderator | | Join Date: Nov 2006 Location: Iceland
Posts: 3,752
| | | re: problem with page redirect and data insertion together Quote:
Originally Posted by samikhan83 4. using PHP_SELF is better than using form action..... That would depend on what you are attempting to do. What is "better" will always depend on the circumstance.
Not to mention that even if you use PHP_SELF, you are still using the form action ;)
But, to the OP's problem.
Whether or not you are posting the data to the current page or any other page, it shouldn't make the slightest difference. Any decent browser should simply fuse the POST data into the request before sending it.
I would bet the problem would be in your server-side script, the one that is meant to process the data into whatever database you are using.
Show us that code please, and we will do what we can to help you figure out a solution.
|  | Moderator | | Join Date: Jun 2007 Location: York, England, with wolves.
Posts: 4,948
| | | re: problem with page redirect and data insertion together Quote:
Originally Posted by samikhan83 hi......
1. U R getting some error ...... for page not found.... if yes write the proper action for form...
2. check weather ur getting all ur required data for ur query...... by echoing or printing the data.....
3. check ur query with the database...
4. using PHP_SELF is better than using form action.....
5. if none of the above then paste ur code..... Please review the posting guidelines: Quote:
Do not use leet speak or text speak, they are not Clear English
| | Member | | Join Date: Sep 2007
Posts: 45
| | | re: problem with page redirect and data insertion together
hi Atli,
Thank u for ur cooperation.
Here is my code : -
<html>
-
<head><head>
-
code:(text)
-
<?
-
if ($c=ocilogon("aa","bb","ccc"))
-
//echo"successfully connected to database.\n";
-
?>
-
-
<?
-
$insert="insert into member_tbl(id,name,age) values('".$_POST['id']."','".$_POST['name']."','".$_POST['age']."')";
-
-
-
$insertparse=ociparse($c,$insert);
-
ociexecute($insertparse);
-
-
?>
-
-
<body>
-
<form action="welcome.php" method="post" name="t1">
-
-
Memberid:<input type="text" name="id" />
-
Name: <input type="text" name="name" />
-
Age: <input type="text" name="age" />
-
<input type="submit"name="submit" value="Submit" />
-
-
</form
-
</body>
-
</html>
-
When i prees submit button,link goes to welcome.php page.but data is not inserting.
But if i use <form action="<?=$HTTP_SERVER_VARS['PHP_SELF']?>" NAME="s1" method="post"> then data is inserting properly but link dones not goto the welcome.php page.
Pls provide me a proper solution.
Thanks
|  | Moderator | | Join Date: Jun 2007 Location: York, England, with wolves.
Posts: 4,948
| | | re: problem with page redirect and data insertion together Quote:
Originally Posted by boss1 hi Atli,
Thank u for ur cooperation.
Here is my code : -
<html>
-
<head><head>
-
code:(text)
-
<?
-
if ($c=ocilogon("aa","bb","ccc"))
-
//echo"successfully connected to database.\n";
-
?>
-
-
<?
-
$insert="insert into member_tbl(id,name,age) values('".$_POST['id']."','".$_POST['name']."','".$_POST['age']."')";
-
-
-
$insertparse=ociparse($c,$insert);
-
ociexecute($insertparse);
-
-
?>
-
-
<body>
-
<form action="welcome.php" method="post" name="t1">
-
-
Memberid:<input type="text" name="id" />
-
Name: <input type="text" name="name" />
-
Age: <input type="text" name="age" />
-
<input type="submit"name="submit" value="Submit" />
-
-
</form
-
</body>
-
</html>
-
When i prees submit button,link goes to welcome.php page.but data is not inserting.
But if i use <form action="<?=$HTTP_SERVER_VARS['PHP_SELF']?>" NAME="s1" method="post"> then data is inserting properly but link dones not goto the welcome.php page.
Pls provide me a proper solution.
Thanks You're not understanding how form submition works; the 'action' attribute of the form is where all the data from the form is sent - in your case 'welcome.php'. What you seem to be thinking is that when the forum is submitted the code on the page with the form is then run - this isn't how it works. You need to relocate the code from your form page to 'welcome.php'.
Furthermore, you could just add in a redirect to your existing code and keep the 'action' attribute as PHP_SELF.
[php]
<?
$insert="insert into member_tbl(id,name,age) values('".$_POST['id']."','".$_POST['name']."','".$_POST['age']."')";
$insertparse=ociparse($c,$insert);
ociexecute($insertparse);
// redirect: no output can come before this
header("Location: /welcome.php");
// you could alternatively output a meta refresh (uncomment to do so)
//echo '<meta http-equiv="refresh" content="2; url=/welcome.php">'
?>
[/php] Quote:
Originally Posted by boss1 hi Atli,
Thank u for ur cooperation.
Here is my code : Yeh.. you're welcome ¬_¬
|  | Moderator | | Join Date: Jun 2007 Location: York, England, with wolves.
Posts: 4,948
| | | re: problem with page redirect and data insertion together
boss1, it is a forum rule that when you post code you use CODE tags. Here is an example:
[code]
// code goes here
<?php
echo 'using code tags!';
?>
[/code]
Which makes it considerably easier to read! -
// code goes here
-
<?php
-
echo 'using code tags!';
-
?>
-
|  | Site Moderator | | Join Date: Apr 2007 Location: Texas
Posts: 5,435
| | | re: problem with page redirect and data insertion together
Boss1, you've already been asked to start using CODE tags (see Markus's previous post for more information).
This message serves as your official warning. Continued violation of the site Posting Guidelines will result in account suspension.
If you have any questions or concerns, feel free to contact me anytime.
Thanks for your time.
pbmods
| | Member | | Join Date: Sep 2007
Posts: 45
| | | re: problem with page redirect and data insertion together
hello,
i m havimg another problem when i use header("Location: welcome.php"); i get this massege is in below:
You don't have permission to access /new/="/new/welcome.php" on this server.
i have used the directory in httpconf file is:
DirectoryIndex index.php index.html
still the the massege is showing.So now what can i do?
pls help me
|  | Moderator | | Join Date: Jun 2007 Location: York, England, with wolves.
Posts: 4,948
| | | re: problem with page redirect and data insertion together Quote:
Originally Posted by boss1 hello,
i m havimg another problem when i use header("Location: welcome.php"); i get this massege is in below:
You don't have permission to access /new/="/new/welcome.php" on this server.
i have used the directory in httpconf file is:
DirectoryIndex index.php index.html
still the the massege is showing.So now what can i do?
pls help me Please show the code you are using.
My guess is that you aren't setting the uri correctly.
|  | Moderator | | Join Date: Nov 2006 Location: Iceland
Posts: 3,752
| | | re: problem with page redirect and data insertion together
This is a file permission error. You, or rather the user which your web-server is running on (usually nobody), does not have permission to read the file you are asking for.
You will have to log into the server and change the file permission.
This should work, either in a Linux kernel or through FTP. -
$ chmod 755 /path/to/your/file.ext
-
| | Member | | Join Date: Sep 2007
Posts: 45
| | | re: problem with page redirect and data insertion together
hi,
A new problem is arised.A massege is coming when i use form action="selfpafe"
and redirection is used that is header("Location:/welcome.php");
The massege is:
The requested URL / welcome.php was not found on this server
Note:the previous error massege is not found again.
so what now?..pls..
|  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,471 network members.
|