load page on PHP form submit

Associate
Joined
6 Mar 2009
Posts
495
Hi Guys, will try to explain without posting a lot of code

I have a php form and on submit it directs to another page.

On the form there is a drop down box and a few option to choose from.

How can i change it so it directs to a different page depending on the option the user chose from the list.

Code:
<form name="search" method="post" action="search_submit.php">

Currently as above it will alway go to the search_submit.php page, so as i said how can i make it go to a different page depending on what option they choose from the drop down menu.

Hope it makes since:)

Cheers
 
Associate
OP
Joined
6 Mar 2009
Posts
495
something like this link.

The safest way is to still go to the search_submit page upon submission, do your form validation etc. From there you use the submitted drop down input to forward the user to the relevant page.

Thanks Guys, will try and see which one works for me.

Cheers
 
Associate
OP
Joined
6 Mar 2009
Posts
495
OK Guys thank again got it working the way i want it now.. I think!!

Have one other issue.

Code:
echo "<td>{$row[ 'TestTime' ]}</td>";

How to i bold the above echo??

Have tried many ways but cannot see it get it to be in bold.

Thanks
 
Associate
OP
Joined
6 Mar 2009
Posts
495
Ok guys got it working now.

Having issue putting data into a table from my database the way i want it.

I want to be able to change the order of the of the columns and not print them the way they are displayed in the database. I also want to highlight or bold certain Columns of data.

Have been using the below code:
Code:
$tbody = '';
$fields = array( 'field1', 'field2', 'field3' );

$thead = "<tr>\n";
foreach( $fields as $field ){
        $thead .= "<th>$field</th>\n";
}
$thead .="</tr>\n";

$tbody = '';
while($row = mysql_fetch_assoc($result)) {     
    $tbody .= "<tr>\n";     
    foreach( $fields as $field ){
            $tbody .= "<td>{$row[ $field ]}</td>\n";
    }
    $tbody .= "</tr>\n"; 
}  
echo "<table>\n$thead$tbody</table>";  

while($row = mysql_fetch_assoc($result)) {     
    echo "<tr>";     
    echo "<td>{$row[ 'field3' ]}</td>";
    echo "<td>{$row[ 'field1' ]}</td>";
    echo "<td>{$row[ 'field2' ]}</td>";
    echo "</tr>"; 
}

The above way puts the column header as it is displayed in the database. My question is how can it set out the names i want for the column headings and then insert the rows of data below it??

Thanks
 
Back
Top Bottom