Jump to content


Photo

Help with if statement


  • Please log in to reply
4 replies to this topic

#1 opel

opel
  • Members
  • PipPipPip
  • Advanced Member
  • 30 posts

Posted 08 October 2006 - 05:52 PM

I have set up a page redirect from an insert from which has "addpage.php?update=true"

I am trying to create an if statement to put on the addpage.php that will echo a statement to let users know the transaction worked.

I have tried to start the statement but it doesnt seem to work, can anyone help?

<?php if header("Location: addlink.php?update=true") echo "Your article has been submitted"; ?>


#2 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 08 October 2006 - 05:56 PM

so you have a page that updates your db and then after it updates your db, you redirect it to another page, and you wish to echo out your 'success' message if the query was successful in the previous page?
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#3 opel

opel
  • Members
  • PipPipPip
  • Advanced Member
  • 30 posts

Posted 10 October 2006 - 02:56 PM

yes exactly, I am using Dreamweaver and it only lets you redirect a page. I would like to echo a success statement based on the update being true.

Sorry never replied sooner never got a notifcation from the forum to my email.

#4 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 10 October 2006 - 03:43 PM

I'm assuming that you're passing true if successful and false if not

addlink.php needs the following at the top...

<?php
if ($_GET['update'] == "true"){
   echo "Your update was successful\n";
}
else if ($_GET['update'] == "false"){
   echo "There was an error inserting your record\n";
}
else {
   echo "You did not submit a valid update option\n";
}
?>

Regards
Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#5 opel

opel
  • Members
  • PipPipPip
  • Advanced Member
  • 30 posts

Posted 10 October 2006 - 08:00 PM

thanks for your help  ;D




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users