473,856 Members | 1,546 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

header("Locatio n: ..."); NOT WORKING!?

I'm working on a very simple peace of php where basically there is a
form and 3 buttoms. One refreshed the page, one posts the form, and
another one (since this form contains values of a record) deletes the
record. The sintax is this one:

if ($delete)
{ header ("Location: $redirect?del=$ code&table=$tab ");
exit;
}

where $delete is the buttom, $redirect is the string containing the url
("http://www...."). $code and $tab are values verified and correct.

Well the funny thing is that this line worked well since I add the
third buttom (the delete) after I added it even the post buttom doesn't
work anymore. Exactly the page refreshes itself wihout changing
parameters ($redirect contains in fact the same page but with different
parameters) and stops loading the page after this line (probabily the
exit() kicking in). Is there another way to redirect a page other then
header()??? It's driving me crazy...help me!

Mar 20 '06 #1
5 3225
Duderino82 wrote:
I'm working on a very simple peace of php where basically there is a
form and 3 buttoms. One refreshed the page, one posts the form, and
another one (since this form contains values of a record) deletes the
record. The sintax is this one:

if ($delete)
{ header ("Location: $redirect?del=$ code&table=$tab ");
exit;
}

where $delete is the buttom, $redirect is the string containing the url
("http://www...."). $code and $tab are values verified and correct.

Well the funny thing is that this line worked well since I add the
third buttom (the delete) after I added it even the post buttom doesn't
work anymore. Exactly the page refreshes itself wihout changing
parameters ($redirect contains in fact the same page but with different
parameters) and stops loading the page after this line (probabily the
exit() kicking in). Is there another way to redirect a page other then
header()??? It's driving me crazy...help me!

How are you setting the value of $delete?
Something like $delete = isset($_GET['del']);

-david-

Mar 20 '06 #2
I always have the following in my coding section:

if (isset($_POST['delete'])) {
stuff....
}

I do this for all buttons that require processing.

The other thing you can do if a redirect is all you want is to use
straight html where you enclose the specified fields (if possible on
your page) within a separate named form whose action is your redirect
and whose fields are named "del" and "table".

Mar 21 '06 #3
The code is like this.
if($_GET['modifica'] && $_GET['table']){
// do stuff
if(mysql_select _db($db_name, $db))
{ // do a query
switch($table){
case 'processori': table_processor i($row,1);
// displays the table at the end of which are the buttoms $delete
and $submit
// create $str with the query
break;
case 'schedemadri': .......break;
default:break;
}
if (isset($_POST['delete']))
{ header ("Location: $redirect");
exit;
}
if (isset($_POST['submit']))
{ if(mysql_select _db($db_name, $db))
mysql_query($st r, $db) or die("Query non valida: " .
mysql_error());
header ("Location: $redirect");
}
}
mysql_close($db );

}

Mar 21 '06 #4
> if ($delete)
{ header ("Location: $redirect?del=$ code&table=$tab ");
exit;
...
Well the funny thing is that this line worked well since I add the
third buttom (the delete) after I added it even the post buttom doesn't
work anymore.


Add the line below to the top of your script file, it may shed some light by
displaying a warning or notice which would not otherwise be displayed. Also,
after adding it, try commenting out the header() and exit() functions, and
just echo $redirect."?del =".$code."&tabl e=".$tab to verify that they are
correct and your script is entering the delete condition.

error_reporting (E_ALL);
// ... your code here

ECRIA
http://www.ecria.com
Mar 21 '06 #5
Problem solve....the funny thing is I don't know how! I just moved a
function (not used in that part of the code) in the <head>...did a few
errors deleting some <div>...then it when all back to normal...mister y
remains!

Mar 21 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
5112
by: Brian Huether | last post by:
Whenever I use this, it doesn't seem to return anything. Any idea what is happening here? My webhost (ipowerweb) uses php 4.3.1. -brian
3
7932
by: www | last post by:
Hi there, I need to calculate working days for a given period, "Date from", "Date To". Plus I want to be able to insert Public Holidays to exclude aswell. Your help will be greatly appreciated. Cheers Charles
11
2661
by: ajikoe | last post by:
Hello, I used Visual C# Standard Edition. I want to comment my program using xml commentary method, I don't know why if I use value and example tag, it is not working / showed in the html result. for example I have Property ///<value>this is in description</value> ///<example>this is in Example</example> public int A{
3
3125
by: | last post by:
Hello, I am hoping someone else has thought about a date time calculation i need to perform. I would like to be able to calculate the number of "working minutes" between 2 dates, given my working week definition. Lets say I have a working week definition of Monday through Friday, 9 am to 5 pm. Date1 = January 1st, 2005 at 8 am
9
3225
by: MSDNAndi | last post by:
Hi, I have a set of simple webservices calls that worked fine using .NET Framework 1.0. I am calling a Java/Apache based webservices, the calling side is not able to supply a proper WSDL. What it does is to call a webservice with two parameters, one being a integer, the other one being a "String" which contains XML (not the best practice, however that is the target interface and we cannot change that).
8
2022
by: David Thielen | last post by:
Hi; ..NET 2.0 I have a situation where when the user selects an item in a drop down list, the code behind is called to update the values in another list on the page. This update can take 3 - 5 seconds. When it is complete, the same page is still displayed. What is the best way to tell the user the page is working? I don't like the idea of switching to a
5
3994
by: Jon via DotNetMonster.com | last post by:
<siteMapNode title="share price" description="Link to Netcall on the London Stock Exchange" url="http://www.yahoo.co.uk" role="" target="_blank" /> Hi all I'm trying to open the Yahoo web site in a new window using the above code in my asp.net web.sitemap. I'm expecting the target="_blank" bit to make it do this. but it isnt. Does anyone know why?? Thanks in advance.
0
1823
by: WORKING IN FAITH | last post by:
three years I LOVE You Monica More options 1 message - Collapse all WORKING IN FAITH View profile More options Nov 13, 11:29 am three years I LOVE You Monica
12
40168
by: ssh | last post by:
function testfn(name) var tbody = document.getElementById('hellospace').getElementsByTagName('tbody'); var row = document.createElement('TR'); var cell1 = document.createElement('TD'); cell1.align="left"; cell1.style.height = "22"; cell1.style.width = "15"; cell1.valign = "middle"; cell1.className = "dwInfo"; var inp1 = document.createElement('INPUT');
1
1299
by: Claire | last post by:
Hi, either I'm going mad or is params not working anymore in VS 2005? I have function as follows public tableEquipment ReadEquipment(bool ReadImages, params Int64 RecIDs) { } if I call "tableEquipment equipment = myDatabase.ReadEquipment(false, RecID);"
0
10700
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10795
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10390
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9536
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7934
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5962
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4581
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 we have to send another system
2
4177
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3203
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.