Updating graphic(s) |
Updating graphic(s) |
tudsy |
Aug 25 2016, 06:22 AM
Post
#1
|
Advanced Member Group: Members Posts: 246 Joined: 30-September 14 Member No.: 21,611 |
Hi
I have written code to update graphic when a user selects a graphic from a drop down menu. But I am having problems in the reload of the page. The following code is what I have done: <html> <head> <title>ECOVIB2D©</title> </head> <body> <?php function graphicSelect($pname){ echo " <select name='Graphic_select' id='Graphic_select' required size='100' onchange='document.getElementById('Graphic').value=this.options[this.selectedIndex].text'>"; echo "<option value='default' style='height:80px;' selected >Click-Tap dropdown menu to view/select $pname 's Art</option>"; foreach(glob("/home/ecovibdc/public_html/ECOVIB2D/MYART/".$pname."/Graphicw/*.bmp") as $files1){ $files1 = basename($files1); $options= "<option value=".$files1.">".$files1."</option>"; echo "$options"; } echo "</select>"; echo "<input id='Graphic' type = 'hidden' name = 'Graphic' value = '' >"; echo $_POST['Graphic']; $selectedgraphicfilenamew='/home/ecovibdc/public_html/ECOVIB2D/MYART/'.$pname.'/Graphic/'.$_POST['Graphic']; return $selectedgraphicfilenamew; } function load_graphic($graphic){ header("Refresh:0;url ='ecovib2d.php'"); $selectedgraphicfilename=substr_replace($graphic,'',-5); $soundfile=$selectedgraphicname.'.wav'; echo "<img src='$graphic' width='450' height='450'>"; echo "<br>"; echo "<tr>"; echo " <td align='center'>"; echo " <p class='style4' >Play the sound for my art</p>"; $soundfiledir ='http://103.226.223.161/~ecovibdc/ECOVIB2D/MYART/'.$pname.'/Sound/'; echo "<audio id='audiotag1' autoplay='none' controls='controls' src='$soundfiledir.$soundfile'></audio>"; echo " <script> var myAudio = document.getElmentById(' audiotag1');myAudio.filename;</script>"; echo " </td>"; echo "</tr>"; } $css = file_get_contents('css_art.php'); echo "$css"; echo "<table align='centre' border='0' width='965'>"; echo "<tbody>"; echo "<tr>"; echo "<td bgcolor='#660000' width='189px'><img height='90' src='http://103.226.223.161/~ecovibdc/ECOVIB2D/MYART/ecovib2d1.jpg' width='90' /></td>"; echo "<td bgcolor='#660000' width='500px'>"; echo "<p align='center'><span class='style4'>ECOVIB2D©</span></p>"; echo "</td>"; echo "</tr>"; echo "</tbody>"; echo "</table>"; echo "<script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-908952-3', 'auto'); ga('send', 'pageview'); ga('require','linkid'); </script>"; echo "<table align='center' bgcolor='#660000'>"; echo "<tbody>"; echo "<tr>"; echo " <br>"; $person ="AdrianTudini"; $personpicture = $person.'.jpg'; $Price ='2.00'; echo "<center> <p class = 'style4'> Price of Art ( without a watermark )(USD): $ $Price </p></center>"; echo "<td align='left'>"; $personpicturedirectory = 'http://103.226.223.161/~ecovibdc/ECOVIB2D/MYART/'.$person.'/'.$personpicture; echo "<img src='$personpicturedirectory' width='450' height='450'>"; echo "</td>"; echo "<td>"; graphicSelect($person); echo " <button onclick ='load_graphic($selectedgraphicfilenamew);'> Submit Graphic </button>"; "<br>"; echo " <img src='260506_2_29w.bmp' height='450' width='450'>"; echo " <p class='style4' >Play the sound for my art</p>"; echo "<audio id='audiotag1' autoplay='none' controls='controls' src='260506_2_29.wav'></audio>"; echo "<br>"; echo "</td>"; echo "</tr>"; echo "</tbody> </table>"; echo "<form action='http://103.226.223.161/~ecovibdc/ECOVIB2D/MYART/process.php?Price=$Price&Graphic=$selectedgraphicfilename' method='POST'>"; echo" <p align='center'><span class='style4'>Enter Full Name:</span></p> <p align='center'><input id='Nameofperson' maxlength='50' name=username size='50' type='text' /></p> <p align='center'><span class='style4'>Enter Email-Address:</span></p> <p align='center'><input id='e-address' maxlength='50' name=email size='50' type='text' /></p> <p align='center'><input type='submit'style='height:65px;width:220px;font-size:36px' value='Buy*' /> <input type='reset'style='height:65px;width:220px;font-size:36px;' value='Clear' /></p> </form>"; echo " <p align='center' class='style5'>* You will be requested by email to pay by Paypal©. Your name and email address will not be sold or traded</p>"; echo "<p align='center' class='style8'><a href='http://ecovib2d.blogspot.com.au'>Back to Ecovib2d's blog</a></p>"; echo "<p align='center'><span class='style8'><a href='mailto:tudsy@ecovib2d.com.au'>Send me Mail</a></span></p>"; ?> </body> </html> Thanks. |
CharlesEF |
Aug 25 2016, 12:55 PM
Post
#2
|
Programming Fanatic Group: Members Posts: 1,981 Joined: 27-April 13 From: Edinburg, Texas Member No.: 19,088 |
I see an error right off the bat. This line is missing quotes around the value attribute:
CODE $options= "<option value=".$files1.">".$files1."</option>"; It should be: CODE $options= "<option value='".$files1."'>".$files1."</option>"; OR CODE $options= "<option value=\"".$files1."\">".$files1."</option>"; |
Christian J |
Aug 25 2016, 01:26 PM
Post
#3
|
. Group: WDG Moderators Posts: 9,661 Joined: 10-August 06 Member No.: 7 |
I have written code to update graphic when a user selects a graphic from a drop down menu. But I am having problems in the reload of the page. Are these two things related? Because there's no point in updating the graphic if the page is being reloaded at the same time. BTW, the lack of formatting makes the code very hard to read, and therefore increases the chance of mistakes. |
Lo-Fi Version | Time is now: 27th April 2024 - 11:50 AM |