-
Posts
3,372 -
Joined
-
Last visited
-
Days Won
18
Everything posted by Muddy_Funster
-
you need to set the <form action"" to point to the current page, not to send.php. setting it to send.php just takes you directly to it. Use an else{} after the if to move to the send.php in the event that the radio button is not selected.
-
geko - I think you might have the wrong idea about what a foreign key is and does. In its simplest form it is just an indexing tool, it lets one table know that if it wants to have a value in that field it has to first be able to reffrence that value in the table that it is looking up for the FK. What type of index it is depends on the relationship between the tables on that field. While you can cascade updates and deletions from the key table down to the child tables, you can't cascade the creation of a new record as there is no way to enforce that a new parent record will always merit a new child record being created at the same time.
-
<input type="radio" name="radio_A/B" value="TRUE" />I want to answer More Questions!<br /> should work with <?php if($_POST['radio_A/B'] == 'TRUE') { header('location: '.$_POST['radio_A/B']); exit; } I think the problem was mainly that you had used double quotes inside the POST[] square brackets. be carefull using the header redirect as well, you can easily loose your information bouncing through too many pages without using sessions to keep it in.
-
seems to be missing the "http:" at the start of the api_url declaration... Probably nothing to do with it, but I know even less about JS than I do PHP
-
If you want to do it in javascript, sure something like that would probably get the job done just fine - assuming the EU has java enabled on their browser. you can also use PHP on the form action page to say <?php if ($_POST['flag'] == 'TRUE'){ include_once "page2.php"; } else { //mail script goes here include_once "thankUser.php"; } ?>
-
Having another look at the table you are using, and I am not just saying this to try and upset you, I mean taking it appart and starting again. Using four or five tables instead of the one that you have now. It will make things better in the long run.
-
Navigation bar that shows submenus when linked is clicked
Muddy_Funster replied to Matt B's topic in PHP Coding Help
From what you just said in your post I'm gauging that this might be a little bit down the road from where you are at just now. It's nothing to do with "Foreign Keys" as they are a form of indexing in a database - nothing at all to do with PHP. Also, your flinging that word "function" around alot in contexts that make me think your not truly femiliar with what a PHP function really is. What you want to do is build up what is known as a menu "breadcrumb" trail. This is a section of code that follows users into the menu options and displays sub menus based on the current position. It can be done using arrays within the php code, or more commonly there is a refference field within the tables of the underlying database structure that is used to get the sub level information. Are you sure you want to go down this road? and if you are, which are you going to use : database or array? -
Using PHP to encrypt/decrypt data to and from the database
Muddy_Funster replied to Hobbyist_PHPer's topic in PHP Coding Help
PHP doesn't encrypt data in transit, that's what SSL is for (which you are using). I'm with betterphp on this one - what exactly are you asking here? -
Yes. The easiest would be to use a checkbox/radio button to choose the option, and then have the php that proccess the first page of the form check that value first and decide what to do.
-
Yip, probably. And it would be much neater and more efficient too, I just wanted to make it clear how to expand on the options of conditional checks in a simple way, so that the OP can see they can expand on the checks to cover whatever they need.
-
The code is most likely dying 'cause somone has used the wrong slashes for the comment "\\ use your table names" You really should have error reporting set to all in the php.ini file for developing to stop blank pages and show what the errors are. The layout that you are looking for is going to be quite complex to achieve given the dataset in the table. You are going to need to run a substring select based on the line break character used in your database text field. It's then going to have to itterate through the full text field and select each new line as a distinct entity to post between the list item tags, this is going to need to be done for every record that you pull from the database. I personaly would look at restructuring your database tables, as in my opinion what you have is less than optimal.
-
a bit of cut and paste using kadeous's original code: if (($_POST['state'] == 'GA') || ($_POST['state'] == 'ga') || ($_POST['state'] == '') || (!isset($_POST['state']))) { exit(); // Or post error to let the user know then exit } else {
-
I think this is more a javascript question than PHP...
-
At a glance all looks fine, except that can't be all the code, or you are using variables that have no value. Try and replace your refference to $_SERVER["PHP_SELF"] with the actual page name and see what happens. Another thing you could try is to run the actual query outside of the form and only itterate through the results inside the select tags, just in case it's masking any error messages. Also - it's no big deal, but you don't need your quotes around the variable here: echo "$newsletter_id"
-
shame on you Kickstart needless use of single letter alliases :'(
-
Just out of intrest, was it the file MIME type expression? I don't use PHP for files much, would like to know incase I need to start some day.
-
Finding all possible combinations of an Array
Muddy_Funster replied to jcsmithy's topic in PHP Coding Help
You do realise that as you increase the number of catagories the number of outputs will increase exponentialy, causing a MASSIVE dataset in a very short time, even just adding the 2 more catagories that you have given, increasing your colour selection to the 8 colours listed and duplicating the number of options (8 and 4) for the next two catagories (size and weight) you would end up with 35,184,372,088,832 results being output by that code...Are you tring to kill somones server? -
Or, to do it in MySQL, set the column type to be INT (3) UNSIGNED ZEROFILL and your done.
-
That would be pretty much the way you have just done it. "Tidy" code isn't about striping the HTML from PHP (or vice versa), it's about making the code logical, ledgible (comments, tabulation, case consistancy etc.) and as modular as possible (modular may not be such a big thing these days, I dunno). The only things you should be taking out of the pages are any lines that have no actual reason being there. I have a good car analogy I can use if you need further convincing
-
Thats actualy not a complicated query... I'm not trying to be insulting, I know it seems like a big step up from simply SELECT FROM WHERE. But the truth is, there are a few core principles that, although daunting at first, once you have a working understanding of you will be pulling out these kind of queries without much problem at all. Try and take some time and read up on JOINS in all their forms and, if you are in a position to, have a play with them in a sandbox. It's not to say that you will ever have to use them again, but it takes a lot of the generated stress out of life when you hit things like this. Also, don't think twice about asking "how does that do what it does". The guys here like Kickstart can clear things up in minutes that would take hours (sometimes days) researching online.
-
Beginner's question about time and data
Muddy_Funster replied to HuntsvilleMan's topic in MySQL Help
WHERE DATE(dateTimeFieldName) = '2011-12-03' should do the trick -
You are trying (for reasons I can't fathom) to force an integer value into a datetime field. Look into using CAST or CONVERT (or rethinking the whole process, which-ever works for you). As for the "1970 thing"...what is the actual value of $expires *at run time* and where is it coming from?
-
Object of class stdClass could not be converted
Muddy_Funster replied to maheswaran's topic in PHP Coding Help
have you tried using print_r() instead of echo? Best I can offer, I can't actualy work out what you are doing here -
Could you nest a counter into the return loop and use that to elect how many of each record is returned? It's quick and dirty, but it saves rewriting the SQL.
-
Looks like it's an issue with the way the line break is being stored/retrieved from the database. I am willing to bet the database is either storing or feeding the line breakes in *nix format, and IE, being IE, gets all upset because it's not windows format. Just a thought, but check on the line break code and see what it's using.