stumped about php
Posted: Thu Jun 05, 2008 9:02 am
Hey guys,
I'm posting this here because I think it is quite possibly a too low-brow question for php.net...
I have some code, and it looks like this:
It gets passed, at one point in time, the variable $_POST['choice'] = 'new'. Which in turn calls a switch statement, which in turn calls this function:
Obviously not the end of the function, but it shows the part that I'm having trouble with. When I call the first switch statement, which calls the appropriate function based on what I've selected, it then calls this function which displays a new entry into the recipe database. The unfortunate part is that something I am doing is forcing this code to spit out the new recipe interface twice, but only going to the case "card": after the second time.
Any ideas?
jsl
I'm posting this here because I think it is quite possibly a too low-brow question for php.net...
I have some code, and it looks like this:
Code: Select all
$main = new main();
// echo ($_POST['choice']. " is your choice");
if(isset($_POST['choice'])){
$main->select_options();
} else if(empty($_GET['rid']) && !isset($_SESSION[edit])){
$main->display_options();
}
if(isset($_SESSION['edit'])){
$main->insert_cards();
}
if(isset($_GET['rid'])){
$main->display_cards();
}
Code: Select all
public function insert_cards(){
$recipe = new recipe();
switch ($_SESSION['edit']){
case "new":
// $_SESSION['edit']="card";
$recipe->new_recipe();
$_SESSION['edit']="card";
break;
case "card":
if ($_FILES["uploaded_file"]){
$picture= new image_upload();
$_SESSION['picture']=$picture->process();
unset($picture);
if (!$_SESSION['picture']){
echo("This recipe will have no picutre<br>");
} else echo("Thank you for uploading a picture of this Recipe.<br>");
}
Obviously not the end of the function, but it shows the part that I'm having trouble with. When I call the first switch statement, which calls the appropriate function based on what I've selected, it then calls this function which displays a new entry into the recipe database. The unfortunate part is that something I am doing is forcing this code to spit out the new recipe interface twice, but only going to the case "card": after the second time.
Any ideas?
jsl