tryingtolearn
Members-
Posts
293 -
Joined
-
Last visited
-
Days Won
1
Everything posted by tryingtolearn
-
php script redirect while sending pdf as attachement
tryingtolearn replied to zamansoomro's topic in PHP Coding Help
If you paste the complete form code it would be much easier to track down your issue. What you posted doesnt give any info of what happens when submit is pressed. Use the code button above (Looks like this <>) to add the code instead of just pasting it in. -
This is how I've handled this in the past. Using your last example (Well the answers aren't correct its just a mix of different combinations) just change your form element id's You should be able to adjust the questions how you need from fill in the blank, multiple choice, and checkboxes. Hope it helps <!DOCTYPE html> <html lang="en"> <head> <meta charset=utf-8> <title>test</title> </head> <body> <?php if ($_SERVER['REQUEST_METHOD'] == 'POST') { $qa = $_POST['q']; $correct = 0; $answers = array(1 => array('A','B'), 2 => array('A','B','C'), 3 => array('A'), 4 => array('A','B','C','D'), 5 => array('A','B'), 6 => array('A','B'), 7 => 'cat', 8 => 'B', 9 => 'C', 10 => array('A','B')); $total = count($answers); foreach($answers as $k => $v){ if(is_array($v)){ if($qa[$k] === $answers[$k]){ $correct++; } }else{ if($qa[$k] === $answers[$k]){ $correct++; } } } $grade= ($correct/count($answers))*100; echo"<p>Score $grade %</p>"; } ?> <form action="index.php" method="post"> <ul> <li id="q1"> <div class="Question">Check each item that can be found in our solar system.</div> <div class="Answer" style="margin-top: 5px; background: #000; color: #fff; text-align: center;"> <label for="q1-A"><input type="checkbox" name="q[1][]" id="q1-A" value="A" >planet</label> <label for="q1-B"><input type="checkbox" name="q[1][]" id="q1-B" value="B" >asteroid</label> <label for="q1-C"><input type="checkbox" name="q[1][]" id="q1-C" value="C" >comet</label> <label for="q1-D"><input type="checkbox" name="q[1][]" id="q1-D" value="D" >black hole</label> <label for="q1-E"><input type="checkbox" name="q[1][]" id="q1-E" value="E">neutrino star</label> <label for="q1-F"><input type="checkbox" name="q[1][]" id="q1-F" value="F">quasar</label> </div> </li> <li id="q2"> <div class="Question">Check each item that can be found in our solar system.</div> <div class="Answer" style="margin-top: 5px; background: #000; color: #fff; text-align: center;"> <label for="q2-A"><input type="checkbox" name="q[2][]" id="q2-A" value="A" >planet</label> <label for="q2-B"><input type="checkbox" name="q[2][]" id="q2-B" value="B" >asteroid</label> <label for="q2-C"><input type="checkbox" name="q[2][]" id="q2-C" value="C" >comet</label> <label for="q2-D"><input type="checkbox" name="q[2][]" id="q2-D" value="D">black hole</label> <label for="q2-E"><input type="checkbox" name="q[2][]" id="q2-E" value="E">neutrino star</label> <label for="q2-F"><input type="checkbox" name="q[2][]" id="q2-F" value="F">quasar</label> </div> </li> <li id="q3"> <div class="Question">Check each item that can be found in our solar system.</div> <div class="Answer" style="margin-top: 5px; background: #000; color: #fff; text-align: center;"> <label for="q3-A"><input type="checkbox" name="q[3][]" id="q3-A" value="A" >planet</label> <label for="q3-B"><input type="checkbox" name="q[3][]" id="q3-B" value="B" >asteroid</label> <label for="q3-C"><input type="checkbox" name="q[3][]" id="q3-C" value="C" >comet</label> <label for="q3-D"><input type="checkbox" name="q[3][]" id="q3-D" value="D">black hole</label> <label for="q3-E"><input type="checkbox" name="q[3][]" id="q3-E" value="E">neutrino star</label> <label for="q3-F"><input type="checkbox" name="q[3][]" id="q3-F" value="F">quasar</label> </div> </li> <li id="q4"> <div class="Question">Check each item that can be found in our solar system.</div> <div class="Answer" style="margin-top: 5px; background: #000; color: #fff; text-align: center;"> <label for="q4-A"><input type="checkbox" name="q[4][]" id="q4-A" value="A" >planet</label> <label for="q4-B"><input type="checkbox" name="q[4][]" id="q4-B" value="B" >asteroid</label> <label for="q4-C"><input type="checkbox" name="q[4][]" id="q4-C" value="C" >comet</label> <label for="q4-D"><input type="checkbox" name="q[4][]" id="q4-D" value="D">black hole</label> <label for="q4-E"><input type="checkbox" name="q[4][]" id="q4-E" value="E">neutrino star</label> <label for="q4-F"><input type="checkbox" name="q[4][]" id="q4-F" value="F">quasar</label> </div> </li> <li id="q5"> <div class="Question">Check each item that can be found in our solar system.</div> <div class="Answer" style="margin-top: 5px; background: #000; color: #fff; text-align: center;"> <label for="q5-A"><input type="checkbox" name="q[5][]" id="q5-A" value="A" >planet</label> <label for="q5-B"><input type="checkbox" name="q[5][]" id="q5-B" value="B" >asteroid</label> <label for="q5-C"><input type="checkbox" name="q[5][]" id="q5-C" value="C" >comet</label> <label for="q5-D"><input type="checkbox" name="q[5][]" id="q5-D" value="D">black hole</label> <label for="q5-E"><input type="checkbox" name="q[5][]" id="q5-E" value="E">neutrino star</label> <label for="q5-F"><input type="checkbox" name="q[5][]" id="q5-F" value="F">quasar</label> </div> </li> <li id="q6"> <div class="Question">Check each item that can be found in our solar system.</div> <div class="Answer" style="margin-top: 5px; background: #000; color: #fff; text-align: center;"> <label for="q6-A"><input type="checkbox" name="q[6][]" id="q6-A" value="A" >planet</label> <label for="q6-B"><input type="checkbox" name="q[6][]" id="q6-B" value="B" >asteroid</label> <label for="q6-C"><input type="checkbox" name="q[6][]" id="q6-C" value="C" >comet</label> <label for="q6-D"><input type="checkbox" name="q[6][]" id="q6-D" value="D">black hole</label> <label for="q6-E"><input type="checkbox" name="q[6][]" id="q6-E" value="E">neutrino star</label> <label for="q6-F"><input type="checkbox" name="q[6][]" id="q6-F" value="F">quasar</label> </div> </li> <li id="q7"> <div class="Question">Scientists believe the universe is:</div> <div class="Answer"> <label class="Wide" for="q7-A"><div class="Radio"><input type="text" name="q[7]" id="q7-A" value="" style="display: inline;"></div></label> </div> </li> <li id="q8"> <div class="Question">Scientists believe the universe is:</div> <div class="Answer"> <label class="Wide" for="q8-A"><div class="Radio"><input type="radio" name="q[8]" id="q8-A" value="A" style="display: inline;"> A.disappearing</div></label> </div> <div class="Answer"> <label class="Wide" for="q8-B"><div class="Radio"><input type="radio" name="q[8]" id="q8-B" value="B" style="display: inline;" > B. expanding</div></label> </div> <div class="Answer"> <label class="Wide" for="q8-C"><div class="Radio"><input type="radio" name="q[8]" id="q8-C" value="C" style="display: inline;"> C. contracting</div></label> </div> <div class="Answer"> <label class="Wide" for="q8-D"><div class="Radio"><input type="radio" name="q[8]" id="q8-D" value="D" style="display: inline;"> D. becoming</div></label> </div> </li> <li id="q9"> <div class="Question">Scientists believe the universe is:</div> <div class="Answer"> <label class="Wide" for="q9-A"><div class="Radio"><input type="radio" name="q[9]" id="q9-A" value="A" style="display: inline;"> A.disappearing</div></label> </div> <div class="Answer"> <label class="Wide" for="q9-B"><div class="Radio"><input type="radio" name="q[9]" id="q9-B" value="B" style="display: inline;" > B. expanding</div></label> </div> <div class="Answer"> <label class="Wide" for="q9-C"><div class="Radio"><input type="radio" name="q[9]" id="q9-C" value="C" style="display: inline;"> C. contracting</div></label> </div> <div class="Answer"> <label class="Wide" for="q9-D"><div class="Radio"><input type="radio" name="q[9]" id="q9-D" value="D" style="display: inline;"> D. becoming</div></label> </div> </li> <li id="q10"> <div class="Question">Check each item that can be found in our solar system.</div> <div class="Answer" style="margin-top: 5px; background: #000; color: #fff; text-align: center;"> <label for="q10-A"><input type="checkbox" name="q[10][]" id="q10-A" value="A" >planet</label> <label for="q10-B"><input type="checkbox" name="q[10][]" id="q10-B" value="B" >asteroid</label> <label for="q10-C"><input type="checkbox" name="q[10][]" id="q10-C" value="C" >comet</label> <label for="q10-D"><input type="checkbox" name="q[10][]" id="q10-D" value="D">black hole</label> <label for="q10-E"><input type="checkbox" name="q[10][]" id="q10-E" value="E">neutrino star</label> <label for="q10-F"><input type="checkbox" name="q[10][]" id="q10-F" value="F">quasar</label> </div> </li> </ul> <input type="submit" name="submit" value="submit" /> </form> </body> </html>
-
You have set the content type header to text/html otherwise it will be treated as plain text. Here is an example you can adapt. Ref - http://php.net/manual/en/function.mail.php Example #4 <?php $to = '[email protected]';// to email address // subject $subject = 'Send a pic'; // message $body = ' <html> <head> <title>My Pic</title> </head> <body> <p>Name:'.$name.'</p> <p>Email:'.$email.'</p> <p>Message:'.$message.'</p> <img src="YOUR_IMAGE_URL.jpg"> </body> </html> '; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'To: name <[email protected]>' . "\r\n"; $headers .= 'From: pic example <[email protected]>' . "\r\n"; // Mail it mail($to, $subject, $body, $headers); ?>
-
As Psycho pointed out earlier, there may be(are) more issues in the code. You can check how valid the code is and get a good starting point to correct most issues using the W3C Markup validator
-
if you view the page source its on line 327 right after the closing div for div id="wpContent" look at the code that includes those blog posts in that section of your site. Im guessing, if you didn't add it there static, its being included from wherever that text is coming from.
-
clear:both is going to make the element drop below any floated elements before it in the document. Since the sidebar is floated it is dropped down below the side bar (Also why when you remove the floated sidebar it jumps back up). So given that, you can make it wider but if the sidebar is floated and you leave the clear:both div in there, in theory, it will (Or maybe I should say it SHOULD) still drop to the bottom of the floated element before it - being the sidebar. How is this text being added to your site From the database or is it just static text?
-
Not really, not sure how you are putting all the content together and I dont use wordpress... I would check around how that opening paragraph is getting populated. looks like a function called have_posts() or the_content() I would start with how or where that opening paragraph is being added. The line is right between that wpContent and the todoBlock divs.
-
Find where this line <div style="clear:both;"></div> is being inserted in the wpContent div and remove it.
-
Hopefully this works better for you.. //condition, $condition = isset($result['condition'][0]['conditionDisplayName'][0]) ? $result['condition'][0]['conditionDisplayName'][0] : ""; //shipping costs, $ship = sprintf("%01.2f", $result['shippingInfo'][0]['shippingServiceCost'][0]["__value__"]); buy it now available, $binauc = isset($result['buyItNowAvailable'][0]) ? $result['buyItNowAvailable'][0] : ""; product category $cat1 = isset($result['primaryCategory'][0]['categoryName'][0]) ? $result['primaryCategory'][0]['categoryName'][0] : "";
-
Here is a stab in the dark not seeing your code You can try: For condition use $cond = $result->condition->conditionDisplayName; For shipping costs use $ship = sprintf("%01.2f", $result->shippingInfo->shippingServiceCost); For buy it now available use $bina = $result->listingInfo->buyItNowAvailable; For product category use $category = $result->primaryCategory->categoryName;
-
Wanted to know if it was the finding API Is any part of your api call working? Do you get a response at all? Are you getting any values returned from what you posted above? If so which ones..
-
I need help with text size in php contact form
tryingtolearn replied to msirl's topic in PHP Coding Help
In your style sheet look for a line for p.response{} it will have something like font:10px; or font:11px; inside the {} Change that number to the pixel size you desire. font:20px; for example -
Probably could use a bit more info What API are you using
-
There are tons of examples by searching image upload, php mysql If those aren't of any use you may want to give some specifics in what you are looking for. General image upload scripts are a dime a dozen..
-
How to create simple organisation management
tryingtolearn replied to aixen083's topic in PHP Coding Help
Can a teacher be registered to more than one organization? Can a student be registered to more than one organization? -
How can I Generate a page using jquery Dynamic form field..
tryingtolearn replied to Sykat's topic in PHP Coding Help
Change all the field names to name="p_new[]" even in the JavaScript and in the foreach use $_POST['p_new'] not $_POST['p_new_'] like I used in the example. -
How can I Generate a page using jquery Dynamic form field..
tryingtolearn replied to Sykat's topic in PHP Coding Help
I wouldn't increment the field names (p_new_1, p_new_2... p_new_21, p_new_22) Make that into an array <input type="text" id="p_new" size="40" name="p_new[]" value="" placeholder="Input Value" /> Then when you submit the form use a loop to echo the values foreach($_POST['p_new'] as $k => $v){ $cleanv = strip_tags($v);//its a users input so I wouldn't trust it as is - use some form of checking here echo "$k - $cleanv<br />"; } -
The issue is what will pass through the filters ebay has in place when you add a listing. The catch all from their HTML and javascript policy being (But oddly enough they allow flash content so go figure...you can add anything you want in a .swf file and load it right up to your listing.) There are "certified 3rd party apps" that might be a better route. At least you wont run the risk of violating their listing guidelines by bypassing any of their filter techniques to make it work.
-
You wont be able to run the php directly off of ebays page. Depending on what you are trying to achieve there may be other alternatives.
-
Change if(($nowTime < $startTime && $nowTime > $stopTime) OR (in_array(date('l'), $offDays)) to if(($nowTime < $startTime || $nowTime > $stopTime) || (in_array(date('l'), $offDays)))
-
I would make sure it is configured to send mail Maybe This link can explain how
-
Im sure there are other ways but here is a stab at something to try.. Set the off days, and holiday arrays and change the start and stop times to suit your needs //Set the days off here [i.e. 'Monday', 'Tuesday'.... or 'Wednesday', 'Saturday'...] $offDays = array('Sunday','Saturday'); //Set the holidays here [Full month and Date] $holiday = array('January 1', 'March 5', 'April 7'); //Business Hours $date = date_create(date('Y-m-d')); $setNow = date_time_set($date, date('H'),date('i'),date('s')); $nowTime = date_format($setNow, 'Y-m-d H:i:s'); //set the time you open [If you open at 5:00 a.m. set 5, 0, 0 - if you open at 10:30 a.m. set 10, 30, 0] $setStart = date_time_set($date, 6, 0, 0); $startTime = date_format($setStart, 'Y-m-d H:i:s'); //set the time you close [If you close at 5:00 p.m. set 17, 0, 0 - if you close at 10:30 p.m. set 22, 30, 0] $setStop = date_time_set($date, 17, 0, 0); $stopTime = date_format($setStop, 'Y-m-d H:i:s'); if( ($nowTime > $startTime && $nowTime < $stopTime) && (!in_array(date('l'), $offDays)) && (!in_array(date('F d'), $holiday)) ){ //normal busines hour code echo"We are open"; }else{ //after hours / weekend / holiday code echo"We are closed"; }
-
also looks like date("H") > 17 wont trigger until it is 6:00 pm, not after 5:00 pm do you need to factor in holidays for this?
-
Have you sent email from this site successfully in the past? Might want to post the updated code you are using now
-
did you set the $to back to your email after making all the changes?