I seem to have a problem with an email form I am making.
the form worked correctly until I added some extra parts to it. however, even when I comment my changes, it won't work.
I thought the problem might be due to some syntax error, but It doesn't seem to be so.
I do not get any error message
below is my code:
<?php
if(isset($_REQUEST['email'])) {
$num=$_REQUEST['num'];
$desc=$_REQUEST['desc'];
$subject="einak";
$nomr=$_REQUEST['nomr'];
$sphr=$_REQUEST['sphr'];
$cylr=$_REQUEST['cylr'];
$angr=$_REQUEST['angr'];
$addr=$_REQUEST['addr'];
$diar=$_REQUEST['diar'];
$noml=$_REQUEST['noml'];
$sphl=$_REQUEST['sphl'];
$cyll=$_REQUEST['cyll'];
$angl=$_REQUEST['angl'];
$addl=$_REQUEST['addl'];
$dial=$_REQUEST['dial'];
$type=$_REQUEST['type'];
$matter=$_REQUEST['matter'];
$color=$_REQUEST['color'];
$message=$num."<br />".$nomr."<br/>".$sphr."<br/>".$cylr."<br/>".$angr."<br />".$addr."<br />".$diar."<br />"."<br />".$noml."<br/>".$sphl."<br/>".$cyll."<br/>".$angl."<br />".$addl."<br />".$dial."<br />".$desc."<br />".$type."<br />".$matter."<br />".$color."<br />";
$email='info#toosoptic.ir';
$headers='MIME-Version: 1.0'."\r\n";
$headers.='Content-type: text/html; charset=iso-8859-1'."\r\n";
mail("mail#example.com",$subject,$message,$headers);
echo "ارسال شما موفقیت آمیز بود";
} else {
echo "<form method='post'>
<input name='num' id='num' type='text' /> <br />
<input type='text' name='nomr' id='nomr' > <br />
<input type='text' name='sphr' id='sphr'> <br />
<input type='text' name='cylr' id='cylr' > <br />
<input type='text' name='angr' id='angr' > <br />
<input type='text' name='addr' id='addr' > <br />
<input type='text' name='diar' id='diar' > <br />
<input type='text' name='noml' id='noml' > <br />
<input type='text' name='sphl' id='sphl'> <br />
<input type='text' name='cyll' id='cyll' > <br />
<input type='text' name='angl' id='angl' > <br />
<input type='text' name='addl' id='addl' > <br />
<input type='text' name='dial' id='dial' > <br />
<textarea id='desc' name='desc'> </textarea>
<input name='type' type='radio' value='bifocal' id='type1' />
<input name='type' type='radio' value='progres' id='type2' />
<input name='type' type='radio' value='single' id='type3' />
<input name='type' type='radio' value='decen' id='type4' />
<input name='matter' type='radio' value='glass' id='mat1' />
<input name='matter' type='radio' value='plastic' id='mat2' />
<input name='color' type='radio' value='single' id='col1' />
<input name='color' type='radio' value='decen' id='col2' />
<input type='submit' id='sb' value='ارسال اطلاعات' />
<input type='text' name='name' id='name' > <br />
<input type='add' name='address' id='address' > <br />
</form >
<p id='confirmation'></p>
<input type='submit' id='vis' onClick='vis(); return false;' value='تایید اطلاعات'/>";
}
?>
You have not define the name in the submit button here:
<input type='submit' id='sb' value='ارسال اطلاعات' />
Replace above code with the below code:
<input type='submit' id='sb' name='email' value='ارسال اطلاعات' />
You are checking the code if(isset($_REQUEST['email'])) and there is no email field the form as I see.
Basically this check is used for verifying that form have submitted or not(as generally other do). So you need to add the name='email' in the submit button attribute to execute the if condition code..
You're setting a mime header but you're not setting any mime encoding, that might be one issue ;-)
Try using a dedicated package such as PEAR/Mail (and PEAR/Mail/Mime) or phpMailer.
Page contains product details and rate them.
Rating is 5 stars that is works with ajax.
I want to cache these pages in server side but how can i cache product details without rating.
<div class='product-container' >
<div class='product-container-right' >
<h3>product-name</h3><br/>
<p>some detail about product</p>
</div>
<div class='vote-request'>rate this product:</div><br/>
<div id='productvote-20' class='product-vote' >
<input type='checkbox' name='vote' value='1' />
<input type='checkbox' name='vote' value='2' />
<input type='checkbox' name='vote' value='3' />
<input type='checkbox' name='vote' value='4' />
<input type='checkbox' name='vote' value='5' />
</div>
</div>
I want to cache div class='product-container-right' in server side.
how every time page (div class='product-container-right') is loaded from cache read div id='productvote-20' class='product-vote' by javascript( or jquery).
you need to add AJAX request that will run once on document-ready to get rating from PHP page and update the rating
$(document).ready( function(){
$('#productvote-20').load('Rating.php?productId=1');
})
And in that PHP file, you need to output this.. but don't cache that page
<input type='checkbox' name='vote' value='1' />
<input type='checkbox' name='vote' value='2' />
<input type='checkbox' name='vote' value='3' />
<input type='checkbox' name='vote' value='4' />
<input type='checkbox' name='vote' value='5' />
What is wrong in this code ? I've tried it on google chrome and the checkbox was UNCKECKED but when trying it on firefox it was checked , how does the code of a CHECKED BOX really have to look like ?
2010-2013 <input type='checkbox' name='actual' value='YES' checked ><br />
2000-2009 <input type='checkbox' name='09' value='YES' > <br />
1990-1999 <input type='checkbox' name='99' value='YES' > <br />
1980-1989 <input type='checkbox' name='89' value='YES' > <br />
1970-1979 <input type='checkbox' name='79' value='YES' > <br />
... -1969 <input type='checkbox' name='69' value='YES' > <br />
<input type='checkbox' name='actual' value='YES' checked="checked" >
Try This.
I am trying to submit the following paypal form through a hosted-payment system. however, it does not seem to be passing through any of the variables apart from the price.
Can anyone see where I am going wrong:
<form action='https://securepayments.paypal.com/cgi-bin/acquiringweb' method='post' target='hss_iframe' id='PayPalForm' name='PayPalForm'>
<input type='hidden' name='cmd' value='_hosted-payment' />
<input type='hidden' name='charset' value='utf-8' />
<input type='hidden' name='currency_code' value='GBP' />
<input type='hidden' name='business' value='seller#email.com' />
<input type='hidden' name='paymentaction' value='sale' />
<input type='hidden' name='template' value='TemplateD' />
<input type='hidden' name='return' value='http://yoursite.com/groupon-success.php' />
<input type='hidden' name='notify_url' value='http://yoursite.com/paypal-groupon- ipn.php' />
<input type='hidden' name='item_name' value='Item name' />
<input type='hidden' name='item_number' value='4' />
<input type='hidden' name='subtotal' value='0.01' />
<input type='hidden' name='custom' value='41' />
<input type='hidden' name='address_override' value='true' />
<input type='hidden' name='first_name' value='Jack' />
<input type='hidden' name='last_name' value='Jones' />
<input type='hidden' name='address1' value='address1' />
<input type='hidden' name='city' value='Manchester' />
<input type='hidden' name='zip' value='M20 1AA' />
<input type='hidden' name='country' value='UK' />
<input type='hidden' name='billing_first_name' value='Jack' />
<input type='hidden' name='billing_last_name' value='Jones' />
<input type='hidden' name='billing_address1' value='address1' />
<input type='hidden' name='billing_city' value='Manchester' />
<input type='hidden' name='billing_zip' value='M20 1AA' />
<input type='hidden' name='billing_country' value='UK' />
</form>
it is then been passed to an iframe which seems to work fine using:
<iframe width="100%" scrolling="no" height="580px" frameborder="no" name="hss_iframe" style="float:right;"></iframe>
<script type="text/javascript">
$(function(){
$("#PayPalForm").submit();
});
</script>
Can anyone help with why this data does not seem to pass anything through
--------------- EDIT
Changed cmd to _xclick and passes through fine, so obviously an issue with _hosted-payment
Can anyone give any ideas
If by "however, it does not seem to be passing through any of the variables", you mean it doesn't display the item name / item number: that's correct. Website Payments Pro Hosted Solution doesn't currently support item details. You should remove these parameters as they're not in use for this product.
In addition, the billing/shipping address will be used, but you won't be able to modify them if you're using templateD.
I have problem with: I want to create admin for add questions to quiz system. Structure is:
<label>Question 1</label>
<input type='text' name='question' value=''/>
<label>Possible reply</label>
<input type='text' name='1' />
<input type='text' name='2' />
...
<input type='text' name='6' />
<label>**Correct reply</label>
<input type='text' name='correct' />
<label>Question 2 </label>
<input type='text' name='question' value=''/>
<label>Possible reply </label>
<input type='text' name='1' />
<input type='text' name='2' />
...
<input type='text' name='6' />
<label>Correct reply </label>
<input type='text' name='correct' />
<label>Question 3 </label>
...
<input type='submit' name='submit' value='submit'>
And I need multiple questions post to Mysql db tables: question, 1,2,3,4,5,6, correct.
I was create this:
<?php
if(isset($_POST['submit']))
{
$question $_POST['question '];
$a = $_POST['1'];
$b = $_POST['2'];
$c = $_POST['3'];
$d = $_POST['4'];
$e = $_POST['5'];
$f = $_POST['6'];
correct = $_POST['correct '];
$result=mysql_query("insert into test (question, 1, 2, 3, 4, 5, 6, correct) values ('$result', '$a', '$b', '$c', '$d', '$e', '$f', '$correct' )");
}
else
{
?>
<label>Question 1 </label>
<input type='text' name='question' value=''/>
<label>Possible reply </label>
<input type='text' name='1' />
<input type='text' name='2' />
...
<input type='text' name='6' />
<label>Correct reply </label>
<input type='text' name='correct' />
<label>Question 2 </label>
<input type='text' name='question' value=''/>
<label>Possible reply </label>
<input type='text' name='1' />
<input type='text' name='2' />
...
<input type='text' name='6' />
<label>Correct reply </label>
<input type='text' name='correct' />
<label>Question 3 </label>
...
<input type='submit' name='submit' value='submit'>
<?
}
But this send only 1 question to DB.
If you can't use
<input type='text' name='question_1' value=''/>
<input type='text' name='question_1' value=''/>
<input type='text' name='question_1' value=''/>
Write in HTML:
<input type='text' name='question[]' value=''/>
<input type='text' name='reply1[]' />
<input type='text' name='reply2[]' />
<input type='text' name='reply3[]' />
<input type='text' name='reply4[]' />
<input type='text' name='reply5[]' />
<input type='text' name='reply6[]' />
<input type='text' name='correct[]' />
In PHP:
<?php
if (isset($_POST['submit'])){
$questions=$_POST['question'];
$reply1=$_POST['reply1'];
$reply2=$_POST['reply2'];
$reply3=$_POST['reply3'];
$reply4=$_POST['reply4'];
$reply5=$_POST['reply5'];
$reply6=$_POST['reply6'];
$correct=$_POST['correct'];
foreach($questions as $key=>$value){
$result=mysql_query("insert into test (question, 1, 2, 3, 4, 5, 6, correct) values ('$value', '".$reply1[$key]."', '".$reply2[$key]."', '".$reply3[$key]."', '".$reply4[$key]."', '".$reply5[$key]."', '".$reply5[$key]."', '".$correct[$key]."' )");
}
}
It would be nice if you can state your database structure and expected result, because it may not work the way you think and we'll never know until we see it.
If you want 1 answer per row, you need to use a multiple row insertion - How to insert multiple rows in single insert statement?.
try that:
<input type='text' name='question1' value=''/>
<input type='text' name='question2' value=''/>
instead of
<input type='text' name='question1' value=''/>
<input type='text' name='question1' value=''/>