HELLO EVERYONE :D
I am having some diffculties passing php varaibles through javascript.
Basically this is the statement:
new Ajax.Updater( 'result', 'update_request.php?status='+status_change);
and I need to pass another variable after status_change, the variable I need to pass is the id of the ticket that is being updated.
So I tried this:
new Ajax.Updater( 'result', 'update_request.php?status='+status_change'&requestid='+request_id);
However this gives me an error stated below:
Webpage error details
Message: Expected ')' Line: 128 Char:
77 Code: 0 URI:
http://site_url/dev/time_off_new/main.php
I have tried double quotes, as well as a combination. I do not know why it is giving me such harrassment.
I ran the php script that it is attached to, and everything is working fine. After debugging I have narrowed it down to this statement, so everthing else is working fine.
Thank you ahead of time.
Peace and love!
You are missing a concatenation operator after the variable status_change
Try this
new Ajax.Updater( 'result', 'update_request.php?status='+status_change+'&requestid='+request_id);
Related
I have a PHP script which I can query with a variable.
Here is the URL to do that:
ajax.php?var=3
And here is the bit (inside the PHP file) that grabs that number - it's a phpBB method that works similarly to GET()/POST():
$alink = $request->variable('var', 1);
echo $alink;
Here's the API section about this 'request' method if interested.
And this is what is outputted on the page when visited:
3
So that works fine. However, when I used a string instead of a number, all it returns is 0 :(
ajax.php?var=Apple
Returns:
0
When visited... so like, why is this and what do I have to do to get my request method to recognised the string? It works fine with a number, so why not a string too?
Thanks :)
UPDATE !!!
It seems that the website I used to test my code has issues and therefore I had problem with executing my thing. I still leave this post up, so someone else, with similar problem can learn something.
website to avoid: http://phptester.net
ORIGINAL POST !!!
I want to add a string to my variable that uses a double qouted word. Is that possible? I only get error.
FATAL ERROR syntax error, unexpected 'Old' (T_STRING) on line number 4
Here is the code:
<?php
$var = "name: ";
$biography = "\n I'm Robert and I came from \"Old\" Europe.";
echo $biography;
?>
I was checking it on this website:
http://phptester.net
It must be smg to do with the new line character in the beginning, or perhaps its not even possible to add double qouted words to a variable. I am not sure.
Your help is greatly appreciated !
php5, Microsoft SQL Server Management Studio, OS 6.3.15063. i get $row data via mssql_fetch_assoc and stuff a PHP array with the $row data just fine when the first record does not have double quotes. subsequent row data can have double quotes, just not the first row. Error: "SyntaxError: missing ) after argument list" in jquery.min - so i cannot peruse and get helpful info from that. code:
$History_SQL = "
DECLARE #AID int;
SET #AID = $Activity_ID;
SELECT activityid, lpid, abstract, changeid, changestamp FROM cpy_activity_history
WHERE activityid = #AID ORDER BY changestamp DESC;
";
$History_results = mssql_query($History_SQL);
while ($row = mssql_fetch_array($History_results)) {
$HistoryRecords[] = $row;
}
This works when record index[0] does not have double quotes, but when double quotes, errors out.
Interestingly, if i use:
$HistoryRecords[] = json_encode($row);
RESULT>>SyntaxError: missing ) after argument list
then it gets past the error; but I am having trouble usind json_decode to get any useful information out of the array [not even getting js braces or anything, getting another record from another table, possibly because this value is not what it thought it was going to be/either way, not sure i am even starting down the right road with json_endode/decode.]
it could be i simply do need help learning how to decode each record coming out of the json encoded var. either way, does this problem look familiar, and any ideas for how to stop getting the error? NOTE: ultimately, i need to display the array information via javascript. other related posts do not seem to cover this scenario. these double quotes are proving maddening. thanks in advance!
thx, All for helping!
the SYMPTOMS included the [a]browser crashing with console/js error: "missing ) after arg list", [b]a var in the code to display an erroneous field, unrelated to the sql used to create info for that var.
the REASON this occurred was that i had within PHP, a console.log that contained a PHP variable. so i was mixing js and PHP. the PHP was firing late and so at the time, the js console.log had nothing to display.
the CLUE which led to fixing this was noticing that the js msg was crashing in the browser, YET the php LOG_IT stmts below the js were working. the js was trying to console.log a msg that had a null value, and somehow a js var was getting loaded with wrong information. sheeze.
the CODE - before the fix the php echo from within the console.log was the culprit. i tossed the original offending stmt, but it was something like this:
<?php here in php land....., now i want to do a console.log....
?><script>console.log("show me info!: " <?php echo $info; ?></script><?php
...back in php land...
i commented out the "echo $info;" and things worked. of course i ripped it out altogether. funny, it would've cleared itself up when i stopped banging my head on the wall and simply decided to clean up and remove all the troubleshooting console.logs.
the CONCLUSION - an old lesson, "don't mix js and php", even in error logging!
thx again for all your help!
Hi im trying to do a SMS feature for my site. This code works well.
https://www.isms.com.my/isms_send.php?un=xxx&pwd=xxx&dstno=".$number."&msg=".rawurlencode($txt)."&type=1"
Although this code doesn't
https://www.isms.com.my/isms_send.php?un=xxx&pwd=xxx&dstno=".$number."&msg=".$msg."%0A".rawurlencode($txt)."&type=1"
As you can see in the &msg= im trying to send 2 variable but the site tells me there is an error of MISSING PARAMETER. How can I properly input that 2 variable for the same parameter?
I guess you want to send a multi line text message with $msg on the first line and $txt on the second.
As per the sparse documentation the end of line character is %0D instead of %0A.
One other remark: the documenation states that the msg parameter must be url encode, so shouldn't you use rawurlencode($msg) as well.
So, all in all the code should probably look like:
"https://www.isms.com.my/isms_send.php?
un=xxx&
pwd=xxx&
dstno=".$number."&
msg=".rawurlencode($msg)."%0D".rawurlencode($txt)."&
type=1"
Note: I've put it on multiple lines for readability only.
Okay so I have my PHP code: (I need help with the 4th line) More info down below the code.
Basicly I am trying to get code below. i am trying to put get part of url but it doesn;'t work
$oIMDB = new IMDB('<?ph p echo$_GET("m");?> ')
and on the 4th line i put the code
and the code doesn't work, how can i use it?
I think you mean this:
$oIMDB = new IMDB($_GET["m"]);
you shouldn't need the php scripting block inside the class call. Function parameters don't need quotes either unless you are using a literal string. Try
$oIMDB = new IMDB($_GET["m"])