stmosaic Posted July 13, 2006 Share Posted July 13, 2006 I've written a php page to display items from a DB, which works fine. But in one instance, in addition to the DB info I wish to display dropdown boxes that impart additional info to be processed by a JS before the add to cart button is clicked. The JS doesn't seem to be working and I'm pretty certain it is JS & PHP interaction issue. When the JS is in an HTML page, it works perfectly. Any ideas of what I need to do to get these to work together?Here is a short version of the code:[code]// In the head: <script type="text/javascript">the javascript that executes with onchange, onclick and onsubmits below</script>//Now for the php & JS issuesif ($mono == "Y") {echo"<form action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\" onsubmit=\"this.target = 'paypal'; return ReadForm(this, true);\"> <input type=\"hidden\" name=\"cmd\" value=\"_cart\"> <input type=\"hidden\" name=\"add\" value=\"1\"> <input type=\"hidden\" name=\"business\" value=\"$PPEMAIL\"> <input type=\"hidden\" name=\"item_name\" value=\"\"> <input type=\"hidden\" name=\"amount\" value=\"\"> <input type=\"hidden\" name=\"currency_code\" value=\"USD\"> <input type=\"hidden\" name=\"baseamt\" value=\"$P\" > <input type=\"hidden\" name=\"basedes\" value=\"$T\"> <input type=\"hidden\" name=\"baseon0\" value=\"Color\"> <input type=\"hidden\" name=\"baseos0\" value=\"\"> <input type=\"hidden\" name=\"baseon1\" value=\"Size\"> <input type=\"hidden\" name=\"baseos1\" value=\"\" > <input type=\"hidden\" name=\"baseitn\" value=\"\" > <input type=\"hidden\" name=\"on0\" value=\"\" > <input type=\"hidden\" name=\"os0\" value=\"\" > <input type=\"hidden\" name=\"on1\" value=\"\" > <input type=\"hidden\" name=\"os1\" value=\"\" > <input type=\"hidden\" name=\"item_number\" value=\"$I\" ><table> <tr> <td rowspan=2 width=\"20%\" valign=\"top\"> <div align=\"center\"><font face=\"Arial, Helvetica, sans-serif\" size=2><a href=\"$SCIMAGEPATHLISTINGSR/$PU\"><img src=\"$SCIMAGEPATHLISTINGSR/$PU\" width=200height=150 border=\"0\"></a></font></div> </td> <td width=\"57%\" valign=\"top\"><font face=\"Arial, Helvetica, sans-serif\" size=\"2\" color=\"#000033\"><b>$T</b></font> <br><b>Item #: $I</b> <br><b><font color=\"#FF0000\">$P</font></b> </td> <td width=\"23%\" valign=\"top\"><font face=\"Arial, Helvetica, sans-serif\" size=\"2\">Quantity <input type=\"text\" name=\"quantity\" size=\"3\" value=1 ><br>Total price </font> <input class=\"nbor\" type=\"text\" name=\"tot\" size=8 value=\"$P\" /> </td> </tr> <tr> <td width=\"57%\"> <p><font face=\"Arial, Helvetica, sans-serif\" size=\"2\">$D </font></p> <p><font face=\"Arial, Helvetica, sans-serif\" size=\"2\">Color - <select name=\"color_1b\"> <option value=\"White\">White</option> <option value=\"Red\">Red</option> <option value=\"Blue\">Blue</option> </select> Size - <select onChange = \"ReadForm (this.form, false);\" name=\"size_2b\"> <option value=\"S\">Small</option> <option value=\"M +0.50\">Medium (+0.50)</option> <option value=\"L +1.00\">Large (+1.00)</option> </select> </font></p> <p><font face=\"Arial, Helvetica, sans-serif\" size=\"2\">Embroidered Monogram? <input type = \"radio\" value = \"Monogram +0.50\" name = \"monogram\" onClick = \"ReadForm (this.form, false);\">Yes<br > Monogram Text: <input type=\"text\" name=\"mono-text\" size=\"20\" ><br > Monogram Font: <select name=\"mono-font\"> <option value=\"\" selected>Select Font</option> <option value=\"arial\">Arial</option> <option value=\"verdana\">Verdana</option> </select><br> Embroidery Color: </font> <select name=\"select\"> <option value=\"\" selected>Select Color</option> <option value=\"E-blue\">blue</option> <option value=\"E-red\">red</option> </select> </p> </td> <td width=\"23%\"> <input type=\"image\" src=\"https://www.paypal.com/en_US/i/btn/x-click-but22.gif\" name=\"submit\" alt=\"cart add\" > <br> <input type = \"button\" value = \"Reset\" name=\"button\" onClick = \"this.form.reset();\" name=\"button\" > </td> </tr></table> </form> ";}[/code]I have already tried one approach that converts the JS events in the PHP to PHP variables & concatenates them so PHP inserts the JS code, but that didn't work. Any help would be greatly appreciated! Link to comment https://forums.phpfreaks.com/topic/14510-integrating-js-within-a-php-page/ Share on other sites More sharing options...
karthikeyan_coder Posted July 13, 2006 Share Posted July 13, 2006 i think you have some errors in your JS file(code)... try to paste those errors here... by seeing error in "Java console" of your browser Link to comment https://forums.phpfreaks.com/topic/14510-integrating-js-within-a-php-page/#findComment-57552 Share on other sites More sharing options...
stmosaic Posted July 19, 2006 Author Share Posted July 19, 2006 karthikeyan_coder,Thank you fo the reply. I'm sorry I didn't see your response earlier(been sick), and have deconstructed that page, going to use PHP only. The problem seemed to come from JS trying to modify some php variables ($P and $T.) Thank you again for trying!! Link to comment https://forums.phpfreaks.com/topic/14510-integrating-js-within-a-php-page/#findComment-60504 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.