Jump to content

Rita_Ruah

Members
  • Posts

    35
  • Joined

  • Last visited

Rita_Ruah's Achievements

Member

Member (2/5)

0

Reputation

  1. Hello, first of all thanks for the replies... I tried again and managed to made it work with the simple change of structure of my array: // From this: // $array[$i]['name'] // To this: // $array['contacts'][$i]['name'] Thank you
  2. <body> <?php $array = array(); for($i = 0; $i < 2; $i++){ $array[$i]['name'] = substr(str_shuffle(str_repeat("0123456789abcdefghijklmnopqrstuvwxyz", 5)), 0, 5); $array[$i]['location'] = substr(str_shuffle(str_repeat("0123456789abcdefghijklmnopqrstuvwxyz", 5)), 0, 5); } $array = json_encode($array); ?> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script> <script> var data = <?php echo $array; ?>; $.ajax({ type: "POST", url: "process.php", data: data, success: function (msg) { console.log(msg); } }); </script> </body>
  3. Even with that output I cant send no data... how would you post this data into a jquery ajax call to other php file?
  4. But I am receiving that with php json_encode... what gives?
  5. Hello, I have an array with this structure: array (size=2) 0 => array (size=2) 'name' => string 'MR A' (length=4) 'location' => string 'A LAND' (length=6) 1 => array (size=2) 'name' => string 'MR B' (length=4) 'location' => string 'B LAND' (length=6) I am trying to send it via Ajax converting the $array with json_encode($array) which results into: [{ name:"MR A", location:"A LAND" }, { name: "MR B", location: "B LAND" }] . But it's giving me an error... each time i make a var_dump from the other file, I find myself stuck with a "undefined". Is the array bad? How should I proceed? Tks EDIT: Please move to the right section (PHP Questions).
  6. Hello, I am trying to create a script to upload videos to youtube automatically... unfortunately I don't understand Oauth2.0, I think it's quite confusing... I cannot find a way to upload videos without login... I want my account details on the php and it automatically uploads new videos in a folder in my site. Any suggestions? Thanks in advance.
  7. Hello, I have a problem with my logic and would like someone to enlighten me. I have two arrays: $array1 contains 1, 2 and 3. $array2 contains 2. I want to know the best way to dinamically check the first array, checks their values, compare to $array2, and insert the missing values in $array2. In my logic: - $array1 is initialized with values 1, 2 and 3; - $array2 is initialized with value 2; - Compare the two arrays; - Insert the missing values (1, 3) into $array2. How can I do this? Can you provide me some code? Thanks
  8. I want to create a simple cms with a simple backoffice so that my parents can use it to add posts to their online cooking book. As I love new ideas, I would want to create a simple cms that instead of a database would use a xml file or something. What main features should I seek, in my head: - 2 or 3 templates - Security (Admin login) - Simple way to add posts - Simple way to edit css (when saving it would save a new css file) Thanks for your feedback
  9. Hello, I haven't found any tutorial regarding this topic, how should I do this? Should the backoffice generate xml? It's a very simple site, but I don't want to use a db. Thanks.
  10. I have this string in Javascript: <MediaFiles> <MediaFile> <![CDATA[VIDEO]]> </MediaFile> <MediaFile> <![CDATA[VIDEO]]> </MediaFile> <MediaFile> <![CDATA[VIDEO]]> </MediaFile> <MediaFile> <![CDATA[VIDEO]]> </MediaFile> <MediaFile> <![CDATA[VIDEO]]> </MediaFile> </MediaFiles> How can I loop through MediaFile in javascript? It's not a xml, it's a string! Thanks!
  11. It's real code... instead of VIDEO there are urls... @Barand Thanks! =) And in Javascript, how would I do this?
  12. Hello, I have a programming doubt... I think this can apply to every language, imagine this scenario where I have this xml: <MediaFiles> <MediaFile> <![CDATA[VIDEO]]> </MediaFile> <MediaFile> <![CDATA[VIDEO]]> </MediaFile> <MediaFile> <![CDATA[VIDEO]]> </MediaFile> <MediaFile> <![CDATA[VIDEO]]> </MediaFile> <MediaFile> <![CDATA[VIDEO]]> </MediaFile> </MediaFiles> How can I count the number of occurences of <MediaFile> so I can make a group of every mediafile and do a Random to select one of them? Pseudo-code of what I want: foreach(<mediafile> of <mediafiles>) array[] = mediafile VIDEO;
×
×
  • 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.