469,621 Members | 1,802 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,621 developers. It's quick & easy.

break out of self-processing form without header("foo.php");

Hola, PHP folk!

I have a php page that contains a self-processing form. The form holds
search results. The search terms originally came from the previous page,
but the user can repeatedly refine the results on the page in question
until the target item can be found. This search refinement is where the
self-processing form comes to play.

The search results are listed in a table with a radio button at the end of
each row. What I would like to do is have the user click the radio button
at the end of the row that lists their target and then click the "Choose
This" button, whereupon they would be directed to the next page, along
with the unique ID of the row they chose.

How do I break out of the self processing part of this form?

I originally tried to use a redirect, something like this:
if($_REQUEST["choose_list"] == "Choose List")
{ header("nextpage.php"); }

This doesn't work in my pages, because I already have a stock header at
the beginning of the page, and this type of redirect conflicts with the
headers I have already sent.

Comments and suggestions appreciated!

---
The rough version of the page can be reached by performing an inital
search (try one of the pull-down values) here:
http://www.bturnip.com/jobmonster/ma...sting_list.php

The next page (edit_existing_list_step1.php) is where I am stuck in my
self processing form.

---
Server info: apache 3.29.x, php 4.3.7

---
Snipped source code of "edit_existing_list_step1.php"

<?php require_once('../header.php'); ?>

<?php
if ($_REQUEST["search_lists"] == "Search" || $_REQUEST["refine_search"] ==
"Search Again" )
{
// handle form data here ...
}
?>

<form method="post" action="<?php echo $_SERVER['PHP_SELF']?>"
onsubmit="return validate_list_selector_form(this);">

<input type="hidden" name="last_search_contractor"
value="<?php echo $contractor ?>">

<input type="hidden" name="last_search_jobname"
value="<?php echo $jobname ?>">

<tr>
<td>
<?php echo $contractor;?>
<select name="contractor">
<option>- select a contractor -</option> <?php
require('./search_logic/contractor_options.inc'); // generate
dropdown ?> </select>
</td>

<td>
<?php echo $jobname;?>
<select name="jobname">
<option>- select a jobname -</option> <?php
require('./search_logic/jobname_options.inc'); // generate dropdown
?> </select>
</td>

<td><input type=text size=15 name=model_or_section
value="<?php echo $model_or_section;?>" >
</td>
<td><input type=text size=15 name=description_keywords
value="<?php echo $description_keywords;?>">
</td>
<td><input type=text size=15 name=location
value="<?php echo$location;?>">
</td>
<td><input type=text size=10 name=material_list_id
value="<?php echo $material_list_id;?>"> </td>
<?php
/* Determine if the show all checkbox was checked in the previous
* search. If so, check it again as the default
*/
if($show_all_lists == true)
{ $checkbox_status="checked"; }
else
{ $checkbox_status=""; }
?>
<td><input type=checkbox name=prev_search_status <?php echo
$checkbox_status; ?> > </td>
</tr>

<tr>
<td><input type="submit" name="refine_search" value="Search Again">
<input type="reset" name="reset" value="Reset"> </td>
</tr>
</table>

<p>

<?php

// results here

if($show_all_lists == true)
{ require('./search_logic/show_all_lists.inc'); }
else
{
// start going into the breakdcown of the search logic.
if($number_of_search_categories ==1)
{ require('./search_logic/search_lists_single_category.inc'); }
else
{ require('./search_logic/search_lists_multiple_category.inc'); }
}
}
?>
<?php //this will have to have a redirect to the next page somehow! ?>

<input type="submit" name="choose_list" value="Choose List">

</form>

<!-- Finish up the page -->
<?php require('../jobmonster_footer_one_level_deep.inc'); ?>
Jul 17 '05 #1
1 2909
"Danny Anderson" <bt*****@i.hate.spam> wrote in message
news:pa****************************@i.hate.spam...
This doesn't work in my pages, because I already have a stock header at
the beginning of the page, and this type of redirect conflicts with the
headers I have already sent.


Well, don't send the header.
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Todd Gardner | last post: by
51 posts views Thread by Noam Raphael | last post: by
7 posts views Thread by newseater | last post: by
5 posts views Thread by vilhelm.sjoberg | last post: by
20 posts views Thread by Wayne Sutton | last post: by
13 posts views Thread by Kurda Yon | last post: by
8 posts views Thread by ssecorp | last post: by
13 posts views Thread by Boris | last post: by
6 posts views Thread by .rhavin grobert | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.