PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hey guys,
im currently trying to self_submit a form and pass the selected drop options by the user to itself as variables.
I have it working but when i press submit, it loads a blank page with the desired results on it, how do i make it show the results on the same page as i choose them from.
<form method="post" action="<?php echo $me;?>">
$Year = $_POST["DYear"];
if (!isset($_POST['submit'])) { // if page is not submitted to itself echo the form
?>
<?
} else {
echo "<b>$Squad</b>";
}
?>
Above is some of the code i used.
Any help appreciated.
mark
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
The output from the script would have to match the original output in some fashion. If removing the conditional does this for you, then it is certainly a viable solution.
im not generating $me, i thought it was some reserved word for self_submitting.
I saw it on some site.
Other than that im not sure because im new to php.
It seems to post data and the data is stored in variables because i can display the contents of the variables.
But i can not use those variables in sql statements, would you have any idea why?
mark16 wrote:im not generating $me, i thought it was some reserved word for self_submitting.
I saw it on some site.
I see. $me is not automatically generated by PHP. The reason I've asked is because all too often many people, newcomers and old farts alike, use the PHP_SELF variable because it refers to the URL that is currently being requested. The problem is it includes user input; input that can lead to injection of information into the HTML that was not intended. To submit back to the page which is displaying the form you can simply use "#" as the action to avoid this security hole. Pretty simple solution.
mark16 wrote:But i can not use those variables in sql statements, would you have any idea why?
I'd like to see the code before I attempt to give you a reason.
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
sorry about the mess, ive been changing and shifting code all over the place.
Basically i wanted just to pull info from a database to populate 4 drop down boxes.
then have user select info from the 4 boxes.
then submit page to itself, store those 4 selected options in variables.
then on the same page display a table, made up of info from a database, the mysql statement is dependent on the reults from the user choices.
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]