473,506 Members | 16,994 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with page redirect and data insertion together

45 New Member
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:
Expand|Select|Wrap|Line Numbers
  1. <form action="welcome.php" method="post">
  2. Name: <input type="text" name="name" />
  3. Age: <input type="text" name="age" />
  4. <input type="submit" />
  5. </form>
pls can any one help me.

Thanks
Aug 13 '08 #1
18 2756
r035198x
13,262 MVP
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.
Aug 13 '08 #2
boss1
45 New Member
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.
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body><form action="welcome.php" method="post">
  3. Name: <input type="text" name="name" />
  4. Age: <input type="text" name="age" />
  5. <input type="submit" />
  6. </form></body>
  7. </html> 
so pls help me how to divert the page to "wlcome.php" as well as data will insert in to db.

Thanks
Aug 13 '08 #3
r035198x
13,262 MVP
header ?
Aug 13 '08 #4
boss1
45 New Member
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
Aug 13 '08 #5
boss1
45 New Member
hei,

i need ur help wthh my specified problem previously disscussed.

it's urgent for me so, pls help me.

Thanks
Aug 14 '08 #6
boss1
45 New Member
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:

Expand|Select|Wrap|Line Numbers
  1. <form action="welcome.php" method="post">
  2. Name: <input type="text" name="name" />
  3. Age: <input type="text" name="age" />
  4. <input type="submit" />
  5. </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
Aug 16 '08 #7
Markus
6,050 Recognized Expert Expert
Show the code you use to insert on welcome.php
Aug 16 '08 #8
samikhan83
33 New Member
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.....
Aug 16 '08 #9
Atli
5,058 Recognized Expert Expert
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.
Aug 17 '08 #10
Markus
6,050 Recognized Expert Expert
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:
Do not use leet speak or text speak, they are not Clear English
Aug 17 '08 #11
boss1
45 New Member
hi Atli,

Thank u for ur cooperation.
Here is my code :
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head><head>
  3. code:(text)
  4. <? 
  5.  if ($c=ocilogon("aa","bb","ccc"))
  6.     //echo"successfully connected to database.\n";
  7.   ?>
  8.  
  9. <?
  10. $insert="insert into member_tbl(id,name,age) values('".$_POST['id']."','".$_POST['name']."','".$_POST['age']."')";
  11.  
  12.  
  13.     $insertparse=ociparse($c,$insert);
  14.     ociexecute($insertparse);
  15.  
  16. ?>
  17.  
  18. <body>
  19. <form action="welcome.php" method="post" name="t1">
  20.  
  21. Memberid:<input type="text" name="id" />
  22. Name: <input type="text" name="name" />
  23. Age: <input type="text" name="age" />
  24. <input type="submit"name="submit" value="Submit" />
  25.  
  26. </form
  27. </body>
  28. </html>
  29.  
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
Aug 18 '08 #12
Markus
6,050 Recognized Expert Expert
hi Atli,

Thank u for ur cooperation.
Here is my code :
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head><head>
  3. code:(text)
  4. <? 
  5.  if ($c=ocilogon("aa","bb","ccc"))
  6.     //echo"successfully connected to database.\n";
  7.   ?>
  8.  
  9. <?
  10. $insert="insert into member_tbl(id,name,age) values('".$_POST['id']."','".$_POST['name']."','".$_POST['age']."')";
  11.  
  12.  
  13.     $insertparse=ociparse($c,$insert);
  14.     ociexecute($insertparse);
  15.  
  16. ?>
  17.  
  18. <body>
  19. <form action="welcome.php" method="post" name="t1">
  20.  
  21. Memberid:<input type="text" name="id" />
  22. Name: <input type="text" name="name" />
  23. Age: <input type="text" name="age" />
  24. <input type="submit"name="submit" value="Submit" />
  25.  
  26. </form
  27. </body>
  28. </html>
  29.  
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]

hi Atli,

Thank u for ur cooperation.
Here is my code :
Yeh.. you're welcome ¬_¬
Aug 18 '08 #13
Markus
6,050 Recognized Expert Expert
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!

Expand|Select|Wrap|Line Numbers
  1. // code goes here
  2. <?php
  3. echo 'using code tags!';
  4. ?>
  5.  
Aug 18 '08 #14
pbmods
5,821 Recognized Expert Expert
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
Aug 18 '08 #15
boss1
45 New Member
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
Aug 19 '08 #16
Markus
6,050 Recognized Expert Expert
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.
Aug 19 '08 #17
Atli
5,058 Recognized Expert Expert
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.
Expand|Select|Wrap|Line Numbers
  1. $ chmod 755 /path/to/your/file.ext
  2.  
Aug 19 '08 #18
boss1
45 New Member
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..
Aug 19 '08 #19

Sign in to post your reply or Sign up for a free account.

Similar topics

3
5999
by: Raju V.K | last post by:
I am developing a PHP-mysql database. It is noted that when the browser window is refreshed the data is inserted again in the database. unfortunately there is no unique keys that I can use to...
1
1834
by: Ronan | last post by:
Hi, I have a problem with a form using the PHP PEAR HTML_QuickForm package & javascript: I want to record the content of my form into a mySQL database then execute a javascript function. ...
5
6036
by: John N. | last post by:
Hi All, Here I have a linked list each containing a char and is double linked. Then I have a pointer to an item in that list which is the current insertion point. In this funtion, the user...
0
6289
by: mharris | last post by:
I need help with merging two Word documents into one through C# code. The problem isn't so much getting the documents put into one as it is maintaining the appropriate formatting, or rather...
0
1432
by: ScriptNFool | last post by:
Ok... I've mooched off this group for a while now. Time to give some code back. Here's a class I wrote to solve the problem of handling query strings. I use it for an application where the...
3
2115
by: André | last post by:
Hi, I want to include a graphic made in file2 into file. File must first send a value to file2 (with Response.Redirect) which will be used for the graphic. My problem is that only the graphic is...
0
1357
by: Syoam4ka | last post by:
My project is about jewellery. I have devided my jewelery into main types, which each one of them has sub types, and each one those sub types has the jewellery. I have a tabcontainer. It includes...
11
12962
by: gotonagle | last post by:
hi, can some help me in this regard i m entering some values in my databse from my asp page. for this i m using a submit button which submit the form to a new page that is 'insert.asp'. this page...
2
2611
by: sirdavethebrave | last post by:
Hi guys - I have written a form, and a stored procedure to update the said form. It really is as simple as that. A user can go into the form, update some fields and hit the update button to...
0
7218
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7370
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7021
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7478
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5035
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1532
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
409
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.