Jump to content

Accurax

Members
  • Posts

    246
  • Joined

  • Last visited

    Never

Everything posted by Accurax

  1. i ant im afraid ..... this needs to happen automatically .... looks like i may have to figure it out myself.... really appreciate the help though guys
  2. bump... could really do with some more input on this if anypne has a few moments to spare thanks in advance
  3. this shouldnt be this difficult surley .... its still doesnt work.... heres the conditional imusing to check if the form is submitted: <?php if(isset($_POST['prescription'])){ echo "waaaahey"; } ?> ive tried this before and after the while loop and to no avail... i just dont know whats wrong sorry to keep pestering but i really am stumped
  4. $row['title'] gets set just before the form starts heres the complete code... including the loop im using: <?php $id = $_SESSION['customer_id']; $query = "SELECT * FROM mytable WHERE customers_id='$id'"; $result = mysql_query($query) or die ("could not find name"); echo "<table id=\"pres_box\" cellpadding=\"0\" cellmargin=\"0\">"; echo "<form method='post' action='" . $self . "'>"; echo "<tr>"; echo "<td colspan=\"2\" class=\"title\">"; echo "Select your option"; echo "</td>"; echo "</tr>"; while ($row=mysql_fetch_array($result)) { echo "<tr>"; echo "<td>"; echo $row['title']; echo "</td>"; echo "<td>"; echo "<input type=radio name='myform' value='" . $row['title'] . "' onChange='this.form.submit();'>"; echo "</td>"; echo "</tr>"; } echo "</form>"; echo "</table>"; ?> how would i go about ending and restarting the while loop... as you can see i need a radio button for each entry in the database... this could be anything from 1 - 100
  5. Here's some code that works correctly... tyhere are clear differences, but maybe someone will spot something i've missed <?php if(isset($_POST['myform'])){ echo "waaaahey"; } ?> <form method="post"> <input type=radio name='myform' value='test' onchange='this.form.submit()'> </form> As you can see when the form and onChange even are outside of the php then it works correctly..... problem is i need to produce my radio buttons via a while loop, so that isnt an option
  6. Doesnt seem to make any difference.... the form looks like its submitting... the page refreshes, but my conditional never seems to hold true ....
  7. Hmmm ... that doesnt seem to help my friend.... <?php if(isset($_POST['myform'])){ echo "form submitted"; } echo "<form method='post'>"; echo "<input type=radio name='myform' value='" . $row['title'] . "' onchange='this.form.submit();'>"; echo "</form>"; ?>
  8. Hi chaps... Ok i have the following form... which self submits when a user selects one of the many radio buttons. <?php if(isset($_POST['myform'])){ echo "form submitted"; } echo "<form method='post' action='" . $self . "'>"; echo "<input type=radio name='myform' value='" . $row['title'] . "' onchange='this.form.submit();'>"; echo "</form>"; ?> I need to get this submitted form value into a session somehow.... but at the moment i cant seem to make the page accept the form was submitted. I was hoping someone may be able to point me in the right direction to gettng this working? ... i think it may have something to do with the way the page is processed ie.. php on the server JS on the client.... its a strange old problem ... any and all advice seriously appreciate d!! Accy
  9. lol... its ok i was being a muppet .... must be this cold ive got ... im about to post a thread to do with the "real" issue here... this however is solved in itself... thanks for those who took the time to look hmmm cant seem to see the "mark as solved" option
  10. Hi guys, Been a while since ive written much php... and i think this may be a dense question ... but.. i cant seem to make a javascript onclick event fire when its echo'd out inside a php statement.. see below: echo "<form method='post' action='" . $self . "'>"; echo "<input type=radio name='radio' value='" . $row['pres_title'] . "' onchange='this.form.submit()'>"; echo "</form>"; this works when its just in an html page... but i cant for the life of me seem to make it fire as is shown above ... can anyone shed any light on this please? thanks in advance Accy
  11. Hi guys, I hope this is a simple question.... i just cant find the answer atm. I have a set of cash vluse calculated from a base price and a percentage discount. Now, when this comes out at lets say 12.995 I would like to round this to 12.99 and not 13 as im currently getting .... is there any way of doing this? Really appreciate any help you can give
  12. Fine in principle .... but when you begin to talk about high traffic sites those extra database requests become much more of a problem.
  13. Must be the ammount of beer I drank last nigh, because i keep making silly mistakes that take hours to figure out. ive got it
  14. your a star taith ... thankyou so much dont suppose you could take a peak at my strip_slashes problem could you
  15. I want to be able to apss strings pulled from my database through my URL so i can $_GET them, I can pass them manually by swapping any spaces out with a +, but i cant figure out how to do this automatically, ive been playing with preg_replace, but it doesnt seem to want to play. anyone know how to do this?
  16. yes im using $_GET, Basically the process is as follows; 1) User arrives at the page greeted by my friendly form 2) User either types in his/her own phrase, or visits my "premade" phrases page 3)assuming user selects a premade, clicking on the phrase will return the user to the form where there selected phrase is displayed in the default colour (black) 4) the user can then adjust the font and colour, as many times as they wish, untill they are happy. Problem is with phrases that contain ' everytime the user makes a change a slash gets added heres the code for the form / preview box <body> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get"> <h2>Enter Your Phrase</h2> <input type="text" name="phrase" value="<?php if(isset($_GET["phrase"])) { echo $_GET["phrase"]; } ?>"/> <a href=phrases.php>Or pick from one of our phrases</a> <br /> <h2>Select Your Font</h2> <select name="font"> <?php if(isset($_GET["font"])) { $val = $_GET['font']; echo "<option value=\"$val\" selected=\"selected\">$val</option>"; } ?> <option value="fonts/Adorable.ttf">Adorable</option> <option value="fonts/AMAZR___.TTF">AMAZR</option> <option value="fonts/angelina.TTF">angelina</option> <option value="fonts/Antique Type.ttf">Antique Type</option> <option value="fonts/Ashley.ttf">Ashley</option> <option value="fonts/Charlesworth Bold.ttf">Charlesworth Bold</option> </select><br /> <h2>Select Your Color</h2> <select name="colour"> <?php if(isset($_GET["colour"])) { $val = $_GET['colour']; echo "<option value=\"$val\" selected=\"selected\">$val</option>"; } ?> <option value="red" class="red">Red</option> <option value="pink" class="pink">Pink</option> <option value="blue" class="blue">Blue</option> </select><br /> <input type="submit" /><br /> </form> <?php if(isset($_GET["phrase"])) { $p = stripslashes($_GET["phrase"]); $f = $_GET["font"]; $c = $_GET['colour']; echo "<img src=\"test2.php?phrase=$p&font=$f&colour=$c\" alt=\"\" />"; } ?> </body> </html> there are two other files .... one creates the image itself, and the other allows the user to select premade phrases by passing GET variables. Any idea's?
  17. Hi there gys, any help witht his would be really appreciated. I am passing various strings through a php script to then ahve them display as an image (dont ask lol) I'm using stripslashes(); to avoid any html being entered into the script AND also because some of the strings i'm passing contain the ' char, which gets auto escaped via magic quotes. Now, i can strip this escape char \ away with stripslashes, BUT, if the user makes more changes to the phrase... font... colour etc, then each time they click submit more slashes get added. How can i stop slashes being added at all, maintain security and not go bald through hair pulling? Any clues chaps?
  18. figured it out... I was using the incorrect function for .ttf fonts
  19. i may be wrong.... but i didnt think you could insert php into a css file ....... if there is a way, i definatly want to know about it though.
  20. im trying to calculate the x value to insert into my imagettftext(); function so that the text becomes centered in my canvas. heres my code so far // define the path to the selected font $font = $_GET['font']; //get the phrase and calculate its width for centering $phrase = stripslashes($_GET['phrase']); $phr_len = strlen($phrase); $fnt_wid = imagefontwidth ($font); $phr_wid = ($fnt_wid * $phr_len); //calculate the x co-ordinate $canvas_wid = 600 / 2; $x1 = round(($canvas_wid - $phr_wid)/2); I think the problem is something to do with the size of the font not being specied untill later in my script when i actually execute imagettftext(); But im not sure how to get around this..... my font size is to be fixed at 24 if thats any help. Anybody got any ideas please? Thankyou in advance guys :)
  21. its ok... it was a silly mistake i couldnt see, took a coffee break and ive got it. how do i mark as solved?
  22. I have a script that allows a user to selecta phrase, a font, and a colour of that font and see it previewed in a window below the form. I cant seemt o gett he colour selection to work at all, at the moment it just keeps showing up in red. heres the script First the form <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <h2>Enter Your Phrase</h2> <input type="text" name="phrase" value="<?php if(isset($_POST["phrase"])) { echo $_POST["phrase"]; } ?>"/> <br /> <h2>Select Your Font</h2> <select name="font"> <option value="fonts/Adorable.ttf">Adorable</option> <option value="fonts/angelina.TTF">angelina</option> <option value="fonts/Ashley.ttf">Ashley</option> </select><br /> <h2>Select Your Color</h2> <select name="colour"> <option value="red" selected="selected" class="red">Red</option> <option value="pink" class="pink">Pink</option> <option value="blue" class="blue">Blue</option> </select><br /> <input type="submit" /><br /> </form> <?php if(isset($_POST["phrase"])) { $p = $_POST["phrase"]; $f = $_POST["font"]; $c = $_POST['colour']; echo "<img src=\"test2.php?phrase=$p&font=$f&colour=$c\" alt=\"\" />"; } ?> And now the script to create the image <?php if(isset($_GET['phrase'])) { // Set the content-type header("Content-type: image/png"); $phrase = stripslashes($_GET['phrase']); // Create the image $im = imagecreatetruecolor(400, 100); // Create some colors $colour = $_GET['colour']; if ($colour = 'red') { $col = imagecolorallocate($im, 255, 000, 000); } elseif ($colour = 'pink') { $col = imagecolorallocate($im, 255, 105, 180); } elseif ($colour = 'blue') { $col = imagecolorallocate($im, 000, 000, 255); } else { $col = imagecolorallocate($im, 0, 0, 0); } $white = imagecolorallocate($im, 255, 255, 255); $grey = imagecolorallocate($im, 128, 128, 128); $black = imagecolorallocate($im, 0, 0, 0); //create a border imagefilledrectangle($im, 1, 1, 398, 98, $white); // define the path to the selected font $font = $_GET['font']; // Add the text imagettftext($im, 20, 0, 50, 50, $col, $font, $phrase); // Using imagepng() results in clearer text compared with imagejpeg() imagepng($im); imagedestroy($im); } ?> Can anyone see what im doing wrong? .... my if statements look right to me..... but i cant get the result i expect. Any tips really appreciated on this.... thanks guys
  23. oooh .... so its like passing things via GET in the URL... except the url you passing the variables in is the <img src="">
×
×
  • 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.