Jump to content

wezhind

Members
  • Posts

    46
  • Joined

  • Last visited

Posts posted by wezhind

  1. I don't know if this will help, but you never know :-)

     

    It's just a simple example of the basic logic of what you seem to be trying to do regards the select element. I thought I'd supply it in case you weren't 'getting it'. I have encapsulated places where you should supply own data etc with 2 hash symbols i.e. #your_own_data#

    <form method="get" action="#page_form_should_go_to#">
    <select name="time_slots">
    <?php while(#something = something else#) { ?>
     
    <option value="<?php echo #the_value_you_want_to_pass#; ?>">
    <?php 
    echo #what_you_want_to_show_to_user_for_this_option#; 
    //this could be combination of data i.e you can show the timeslot and the word available if available and so forth... 
    //this is what is displayed to the user NOT what is passed, the value of the option element is what is passed 
    ?>
    </option>
    <?php } ?>
    </select>
    <button type="submit">Book this timeslot</button>
    </form>

    

    

    NOTE: This is ONLY the logic for the select element in a form.

     

    You have the choice of either having a submit button send your form and chosen option OR you can use JavaScript to send the page onChange. I can't think of a way of simplifying it further for you at the moment, but I think you probably have enough info now to work this out for yourself with a little bit of research.

     

    Is the link you gave us an example of what you are trying to achieve or what you have done so far?

     

    My apologies if this is too simplified... i.e. your knowledge is more advanced than I've given credit for. I'm just trying to make it as clear as possible for you.

     

    p.s. what I've offered will NOT give you what maxxd has suggested regards showing the days as well as the timeslots...

  2. I thought you wanted to send multiple messages? I'm not sure how having the userids comma delimited aids that...does the api you are using accept a comma delimited string of userids? Anyway, barand's solution will give you a string containing that - but let us know if that's not what you are intending.

     

    Good luck.

  3. Hi again, I think you should follow the advice regards creating a small connection script and then mess about with that until you actually get the connection...then transfer the correct details (once found) to the SMF forum code/settings.

     

    However, regards using the 'mysql' option instead of 'mysqli', I would advise going with the latter as the mysql option is likely to be deprecated very soon, whereas 'mysqli' won't.

     

    Good luck.

     

    edit: p.s. I find it a little peculiar that the db_name and the db_user are the same...(I'm not saying they aren't correct - it just seems weird)

  4. I'll let ginerjm explain the anchor tag, though I presume he means an <a> that you give an id containing the info you want i.e. the answer identifier ('1-b' ?). Personally I'd probably also give it a class name i.e. <a class="answer" id="..."><input type="radio"...

     

    You could then use jQuery to grab the value (not my greatest skill so excuse any mistakes, but...) in a similar way to this..

    $(".answer").click(function(e) {
        var answer_chosen = $(this).attr("id");
    }

    Though that method is really only if you need the value instantly (you could also fire the event on the <a> tag rather than using jQuery). If you don't need it 'instantly' then why not just post the form and then grab the data. I suppose I'm a little unclear as to your exact requirements. (I'll re-read your post in a min).

  5. Hi again,

     

    As mac_gyver has pointed out you'd be better doing a re-install of the forum (read their post for more detail), however mac_gyver also mentioned that there is a file being included that contains the settings (i.e. the variables) required by the forum to run. In the pasted code, it is probably this line

     

    // Load the 
    settings... 
    require_once(dirname(__FILE__) . '/Settings.php'); 

     

    If you have a look at that file (Settings.php) you will probably find where the variables you are looking for are assigned their values.

     

    Regards the downloading of random files, I didn't actually realise it was being hosted on phpfreaks.com itself - which definitely makes it a little more trustworthy :-)

     

    You could post the Settings.php page here...with db passwords etc obscured... and somebody maybe will be able to help.BUT you are strongly advised to take mac_gyver's advice.

     

    Good luck.

  6. Welcome.

     

    In case you are really new to the PHP world, I'll just point out that the website http://php.net is the main resource to learn about functions, methods etc of PHP. You will probably find yourself referred there more often than not.

     

    Out of interest, are you versed in any programming languages...or are you completely new to them and decided to start with PHP?

     

    Good luck on your PHP learning mission.

  7. For a variable to be used (a variable being $boarddir for instance) then it must hold a value.

     

    To give a variable a value, in PHP you can use $boarddir = 'a/path/to/something'; (as an example).

     

    The variables you are having issues with ($boarddir and $sourcedir) don't hold any values, therefore you need to give them some - and before the line that then trys to use them later on. Though to be honest, I've basically re-iterated what CroNIX said.

     

    As a rule, most of us don't download random files from random strangers...sorry!

  8. Hi again,

     

    Try building the string for the subject before you use it in the mail() function (see below) OR use double-quotes as advised.

    $subject_info = "Login attempt by Username: " . $user;
     
    mail('yourEmailAddress@yourDomain.com', $subject_info, 'This is the body of the e-mail!'); 

    I'm pretty certain you have now been give all the info (or pointers to it) that you require to resolve this issue. As recommended (several times), go and read about the mail() function at php.net - and there are lots of examples and tutorials on this topic on the Internet. Google is your friend (in this circumstance anyway).

     

    Good luck.

  9. Is the image being uploaded? Does it get to the actual insert code? You need some form of error trapping to help you (and us) identify your issue or point you in the right direction. At the very least you may consider after the $sql string is created temporarily putting

    echo $sql; 

    to show you whether the correct SQL is being used - i.e. whether items that are required fields are not being supplied correctly in the SQL etc etc

     

    Good luck

     

    edit: p.s. the error trap you've added appears to only be a connection specific error trap - barand supplied you with a query friendly one, did you add that? Your issue doesn't seem to be with the connection - after all, aren't you able to read from the database?

  10. Hi there,

     

    This isn't an answer to your issue, but I'm wondering if you could assign the mail function to a variable and then test the variable to see if sent... this may help with debugging the issue (it also may not).

     

    I'd do something like:

     

    // admin email 
    $send_admin_email = mail($admin_email, 'Website form submitted', 'Visitor information. Registration: 
    ' . $_SESSION['order_id']."\r\n".' First 
    Name: ' .$_SESSION['fname'].' Last 
    Name: ' .$_SESSION['lname'].' Email: 
    ' .$_SESSION['email'].' Phone: 
    ' .$_SESSION['phone']);
    if ($send_admin_email) 
    { 
    	//the mail function worked
    }

    

    

     

    I realise this doesn't answer your question, but it may help you debug if you blast a few emails out and check the values of the ones that fail.

     

    Good luck.

  11. Hi, I could be wrong, but is the issue to do with you using curly braces instead of square brackets in the following line in absence-get.php:

    $startshift = 
    $row{'startshift'}; $endshift = $row{'endshift'}; 

    I would have thought it should be:

    $startshift = $row['startshift']; $endshift = $row['endshift']; 

    AND the same with this line in your form:

    <input type="hidden" name="eid" value="<?php echo $row{'EID'}; ?>"> 
    

    Good luck.

    • Like 1
  12. I'm quite confused as to what you are actually trying to do. I thought I had it, but you seem to adding other qualifiers.

     

    If you are trying to get info from a page that you have not yet sent to the server to be processed, then you will probably need to use JavaScript to get the value of the element you are interested in.

     

    If this is what you are requiring then perhaps look into Jquery and particularly the .val() functionality.

     

    To then use that info, you'd probably then need to use AJAX calls to process the info without leaving the page.

     

    Good luck.

  13. Perhaps I should have said 'more reputable than some' (I was more thinking malware-free when I wrote that) :-) I did a quick check over the pages I referred to myself and they seemed to include all of the information that the OP would require to resolve their issue, with no particular bad practices or outdated info involved. I went for something simple. I didn't think the relevant pages I found on the MDN were particularly newbie-friendly - but that's my opinion.

     

    A good book is hard to beat and my favourite medium - it naturally deters the hurried copy-and-paste clone-type 'development' that seems to be employed in a lot of modern coding...but again they go out of date quite quickly... oh it's so tricky!

     

    OP: if Jaques1 has reservations about w3schools, I would seriously advise not making it a habit to use info from there, as he indubitably has more knowledge about such things than I (I rarely reference online code-sites anymore) - however, the links I provided should give you what you need to learn to resolve this particular set of issues. As suggested, you may wish to try the Mozilla Developer Network or check Amazon (or your favourite book supplier) for an up-to-date HTML reference manual for future learning.

     

    Good luck.

  14. Some reasonably simple documentation regards HTML forms. This stuff really is the basic building blocks of web development. If you don't know how to do it and can't be bothered learning then you should be paying a developer, not coming on here looking for freebies. Sorry to be harsh, but most of us have spent many sleepless nights sweating caffeine to learn these things. Most of us want to make the learning path easier for the next person, but we don't want to do the actual work for you. I like to get paid for my professional services.;-)

     

    However, your main issue re: form submission, as already pointed out, is that you are trying to submit a form using an <a> tag (which can be done - but is unnecessary in this case). Use an <input type="submit"...> or a <button type="submit"... element to submit the form. Both of them read the destination of the <form> from the action attribute on the <form action="some_page.php"> tag.

     

    Here are a couple of links to reputable sites: 

     

    info about html forms - http://www.w3schools.com/html/html_forms.asp

     

    info about the button element (can be used to submit a form) - http://www.w3schools.com/tags/tag_button.asp

     

    And for redirecting pages - http://www.w3schools.com/php/func_http_header.asp

     

    Good luck.

  15. Additionally, regards use of the isset() function, it would be used similarly to examples below...but php.net is the place for discovering the use of PHP functions, it has a lot of documentation. (http://php.net/isset)

     

    Here's a code example:

    $a = 1;
     
    if (isset($a)) { echo 'The variable exists'; } // $a exists and therefore 
    message shown
    if (isset($b)) { echo 'The variable exists'; } // $b does not exist and 
    therefore the message will NOT be shown

    You can also use:

    if (!isset($a)) { echo "The variable doesn't exist"; } // the message will be 
    shown because the variable does NOT exist

    I hope the examples help a little bit in your understanding of the isset() function.

  16. Hi again,

     

    Regards sql injection, the reason Dreamweaver includes the function GetSQLValueString earlier in your code is to try and alleviate some of those issues by performing some checking/filtering on the data.

     

    An example of Its usage is (in case you don't know)  is per your original line -

     

    where cilindro = ".$_POST['sel_cil']." and esfera = ".$_POST['sel_esf']." and id_lente =". $_POST['sel_lente'];

     

     

    This would now be (using the cleaning function -you can use a flag of "int" or "text" etc):

     

    where cilindro = " . GetSQLValueString($_POST['sel_cil'], "int") . " and esfera = ". GetSQLValueString($_POST['sel_esf'], "int") ." and id_lente =". GetSQLValueString($_POST['sel_lente'], "int");

     

     

    I'll have to reread your posts to ascertain where you are with your main issue and get back to you if I think I can help.

  17. Howdy folks,

     

    Looking forward to learning a lot from you guys and hopefully being able to give some of that back as my PHP skills increase.

     

    I'm not a complete newbie, but I still have a lot to learn.

     

    The forum post that caused me to sign up was made by 'this is not my name' (Jessica), a Guru. The reason it caught my attention was because it made a definite statement about what not to do AND offered an alternative method to achieve the same result. Wow...mature  coders! I signed up minutes later - after I solved the issue 'myself' (shoulders of giants an' all that!) and gained an understanding of a process.

     

    Good to meet you all.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.