| | |
Small syntax error
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Sep 2009
Posts: 11
Reputation:
Solved Threads: 0
Hi all,
Just wondering if anybody can spot the syntax error with the below.
It works fine when I just append one row to the URL like this
The button only stops workin when I append the second 'hotelname' row.
Think its just a syntax error but I cant manage to spot it.
Any suggestions would be much appreciated.
Just wondering if anybody can spot the syntax error with the below.
PHP Syntax (Toggle Plain Text)
'<button type="button" onclick="window.location=\'bookview.php?id='. $row['bookingref'].'&hn'. $row['hotelname'].'\'">Book Now</button>'
It works fine when I just append one row to the URL like this
PHP Syntax (Toggle Plain Text)
'<button type="button" onclick="window.location=\'results.php?id='. $row['proposalid'] . '\'">Book Now</button>'
The button only stops workin when I append the second 'hotelname' row.
Think its just a syntax error but I cant manage to spot it.
Any suggestions would be much appreciated.
•
•
Join Date: Sep 2009
Posts: 11
Reputation:
Solved Threads: 0
Hi pritaeas
Oh sorry I should have said in my post.
When I click on the button it doesnt call bookview.php, it doesnt call any page!
Thanks
Sorry can I also just mention that I made a mistake there in my original post both examples of code I gave should be pointed towards bookview.php and not results.php as I have in my second example.
Oh sorry I should have said in my post.
When I click on the button it doesnt call bookview.php, it doesnt call any page!
Thanks
Sorry can I also just mention that I made a mistake there in my original post both examples of code I gave should be pointed towards bookview.php and not results.php as I have in my second example.
Last edited by debuitls; Sep 16th, 2009 at 9:27 am. Reason: mistake in original post
Not sure, if I put this:
in a test.html file it tries to open bookview.php
Are you missing something else ? Or do you have javascript disabled ?
html Syntax (Toggle Plain Text)
<button type="button" onclick="window.location='bookview.php?id=1&hn'">Book Now</button>
Are you missing something else ? Or do you have javascript disabled ?
Last edited by pritaeas; Sep 16th, 2009 at 9:30 am.
"If it is NOT source, it is NOT software."
-- NASA
-- NASA
This works for me, this sent me to:
http://localhost/bookview.php?id=4&hn=victory
http://localhost/bookview.php?id=4&hn=victory
php Syntax (Toggle Plain Text)
<?php $row['bookingref'] = "4"; $row['hotelname'] = "victory"; echo '<button type="button" onclick="window.location=\'bookview.php?id='. $row['bookingref'].'&hn='. $row['hotelname'].'\'">Book Now</button>' ?>
Last edited by smartness; Sep 16th, 2009 at 9:52 am.
•
•
Join Date: Sep 2009
Posts: 11
Reputation:
Solved Threads: 0
Thanks for your suggestions guys.
Just resolved this.
The syntax
was fine as was suggested.
The problem was that the value I was appending to the URL had a comma in it.
silly mistake
Thanks again
Just resolved this.
The syntax
PHP Syntax (Toggle Plain Text)
'<button type="button" onclick="window.location=\'bookview.php?id='. $row['bookingref'].'&hn'. $row['hotelname'].'\'">Book Now</button>'
was fine as was suggested.
The problem was that the value I was appending to the URL had a comma in it.
silly mistake
Thanks again
![]() |
Similar Threads
- Syntax error ? (PHP)
- Homework due tonight, can't figure it out! "error C2143: syntax error : missing ';' (C++)
- Parse error: syntax error, unexpected $end (PHP)
- Help Needed Parse error: syntax error (PHP)
- IE Syntax Error and Can“t browse some sites (Viruses, Spyware and other Nasties)
- Homework - error C2059: syntax error : ']' (C++)
- syntax error that I just can't seem to find! (Visual Basic 4 / 5 / 6)
- DECLARATION SYNTAX ERROR (for bc 31 user) (C++)
- Parse error, syntax error, Forbids declaration (C++)
Other Threads in the PHP Forum
- Previous Thread: UML Check
- Next Thread: How do i echo a variable in a php mysql query ?
| Thread Tools | Search this Thread |
apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions global google href htaccess html image include insert ip javascript joomla limit link list login mail mediawiki menu mlm msqli_multi_query multiple mycodeisbad mysql number oop parameter paypal pdf php phpincludeissue problem query radio random recourse recursion regex remote script search seo server sessions sms source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign white wordpress xml youtube





