Jump to content

michaelfurey

Members
  • Content count

    24
  • Joined

  • Last visited

Community Reputation

0 Neutral

About michaelfurey

  • Rank
    Member
  1. michaelfurey

    php javascript mysql connection

    Uhm yes the row in the second line is useless because I forgot to delete it. Yep probably I will follow your instructions because I don't want to use JS/Ajax step!
  2. michaelfurey

    php javascript mysql connection

    This is my PHP code: echo "<table>";form($current_php); $cit=do_order("select * from country_itemize_types"); echo "<tr><td>Description: </td><td><select name='descr_ger' id='descr_ger'>"; $descr_sql=do_order("select distinct description from country_itemize_types"); while ($descr_arr=mysql_fetch_array($descr_sql)){ echo "<option>" . $descr_arr['description'] . "</option>"; } echo "</select></td></tr></table>"; And this is my mysql table named country_itemize_types (the table has thousand rows but I pasted here only few lines...): +-----+------+--------------+---------+------------+----------+----------+------------------+ | uid | type | description | country | field | priority | datatype | option | +-----+------+--------------+---------+------------+----------+----------+------------------+ | 1 | 12 | travelcost | ger | vehicle | 1 | char | car;bus;airplane | | 2 | 12 | travelcost | ger | distance | 2 | decimal | | | 3 | 12 | travelcost | ger | times | 3 | integer | | | 4 | 12 | travelcost | ger | cost | 4 | decimal | | | 5 | 12 | randomcost | ger | earthquake | 1 | char | weak;strong | | 6 | 12 | randomcost | ger | seaquake | 2 | char | weak;strong | | 7 | 12 | randomcost | ger | cost | 3 | decimal | | | 8 | 12 | marriagecost | ger | times | 1 | integer | | +-----+------+--------------+---------+------------+----------+----------+------------------+ I would like to create a select tag containing all the descriptions of the table (see the php code above) and when the user selects an option on this select tag should appear some input tag. For example if the user selects from the dropdown menu "travelcost" should appear 4 new input tags (vehicle, distance, times, cost). If the user selects "marriagecost" should appear only one new input tag (times). How can I do that? I suppose that I have to run a sql query with javascript or something similar but I am a newbie in javascript...
  3. michaelfurey

    view online xml with tags

    Is it possible to download the output of the previous code from the server to the client? In that way I should obtain the xml content in the client without copying and paste through the browser. In other words I would like to run a file located in the server that generates the xml file and to download it authomatically to the client.
  4. michaelfurey

    view online xml with tags

    Ok perfect that I wanted to know! I apreciated also the test that you created for me to check if I have some problem solving skills ( " htmlsCpecialchars($xml) " ).
  5. michaelfurey

    view online xml with tags

    I have to generate the following text with a php script in the server and render it in chrome, then copy it manually with the mouse and finally paste it manually in a xml file located in my desktop pc. The text is the following: <?xml version="1.0" encoding="UTF-8"?> <shiporder orderid="889923" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shiporder.xsd"> <orderperson>John Smith</orderperson> <item> <title>Hide your heart</title> <quantity>1</quantity> <price>9.90</price> </item> <item> <title>Hide your heart</title> <quantity>1</quantity> <price>9.90</price> </item> </shiporder> The problem is that I have to render in the browser also the tags and the text included inside the tags... is it possible to render that text in chrome in that way?
  6. michaelfurey

    auto fill in input tag from date selected

    Ok perfect solved! function switchDay (dateInput) { var date = dateInput.value; var dayF = new Date(date); var dayNumber = dayF.getDay(); switch (dayNumber) { case 0: day = "Sunday"; break; case 1: day = "Monday"; break; case 2: day = "Tuesday"; break; case 3: day = "Wednesday"; break; case 4: day = "Thursday"; break; case 5: day = "Friday"; break; case 6: day = "Saturday"; } return day; } document.querySelector("input[name='date']").addEventListener('change', function(e) { var dateInput = e.target; day = switchDay(dateInput); $('input[name=day]').val(day); });
  7. I have a php file and in javascript I am a newbie. This is my php code: echo 'Date:<input type="date" name="date">'; echo 'Day:<input type="text" name="day">'; I would like that when the user select a date from the input "date" in the input "day" appears the right day. For example if the user writes "18/07/2017" in the input "date", in the second input tag should appear "Tuesday". Is it possible to do that?
  8. michaelfurey

    running php on windows 10

    Uhm I will try to install it... then I will give you a feedback!
  9. michaelfurey

    running php on windows 10

    I downloaded and install php 7 and apache 2.4 on windows 10 but it didn't work. Probably Apache gave me problems. Do you know other ways to run PHP on windows 10? Maybe Apache wasn't the best solution?
  10. Starting from a PHP script I would like to select some options of a multiple select... but I don't know how. This is my html code: <select id="pairlang[]" name="pairlang[]" multiple size=3> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="mercedes">Mercedes</option> <option value="audi">Audi</option> </select> <input type="submit" value="save allllll" name="update" class="great" onclick="pairSave()"> This is my js code: function pairSave() { var newJs = <?php echo json_encode($pair); ?>; alert(newJs); } The output of the alert is an array: volvo,saab Someone knows how to select the options volvo and saab with the function pairSave?
  11. michaelfurey

    select showing options without click

    This is my code: <script type="text/javascript"> $(document).ready(function() { $(".js-example-basic-single").select2(); }); </script> <select class="js-example-basic-single"> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="opel">Opel</option> <option value="audi">Audi</option> <option value="fiat">Fiat</option> <option value="mercedes">Mercedes</option> <option value="bmw">BMW</option> <option value="tata">Tata</option> </select> Unfortunately I am using Select2 that is a plugin of jquery... I have the impression that the attribute size doesn't work with it.
  12. michaelfurey

    select showing options without click

    I would like to create a select that shows immediately some option values without waiting that the user clicks on the arrow in order to see the option values... is it possible?
  13. michaelfurey

    change <p> text with ajax and php

    Because I am using a particular web framework written in PHP and to apply a change I have to reload the entire page.... so I was thinking to use Ajax in order to reload only an element to apply a change, as a <p> in this case.
  14. michaelfurey

    change <p> text with ajax and php

    data is a way that I tried to put inside the <p> element the selected option values with ajax... I would like to echo 'selectedOptionValue' inside the <p> element. So if I select the option One and Two I would like to read inside the <p> One and Two.
  15. michaelfurey

    change <p> text with ajax and php

    I would like to change the <p> text in the following way but it doesn't work: PHP code: echo "<p id=\"change_me\">" . $_POST['data'] . "</p>"; echo "<select onchange=\"getval(this);\" id=\"status\" multiple>"; echo "<option value=\"1\">One</option>"; echo "<option value=\"2\">Two</option>"; echo "<option value=\"3\">One</option>"; echo "<option value=\"4\">Two</option>"; echo "</select>"; JS code: $(function() { // on page load $('#status').on("change",function(e) { $("#change_me").empty(); // clear the container var selectedOptionValue = $(this).val(); if (selectedOptionValue) { // in case they select "Please select" $.ajax({ url: '/other/shipments.php', type: 'POST', data: {data : selectedOptionValue }, dataType: 'text', success: function(data){ $("#change_me").html(data); } }); } }); }); I would like to echo the selected option values of the multiple select but it doesn't work. For example if I substitute $("#change_me").html(data); with $("#change_me").html('viva'); PHP echo correctly the string 'viva'... but I would like to echo the selected values 'data' and the code doesn't work. Can someone help me?
×

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.