Welcome to WebmasterWorld Guest from 54.226.241.8

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

if empty do.esle,.does not work, canīt see reason

     

helenp

5:04 pm on Nov 23, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,
Been all day looking at this code, think im going crazy as it looks correct to me, must me somengthing so stupid that I canīt see it.

I have one page with a form where one choose between two values in radiobuttons, if one click on the sendbutton without checking any of the buttons, a javascript function is ejectuded telling to choose one of them.
first the javescript then this code comes:
<?php 
$propiedad = @mysql_real_escape_string($_POST['propiedad']);
$bookingway = @mysql_real_escape_string($_POST['bookingway']);
$instant = @mysql_real_escape_string($_POST['instant']);
$enquirer = @mysql_real_escape_string($_POST['enquirer']);
?>
<div class="bookingway">
<form action="bookingways.php" method="post" name="bookingways" id="bookingways" onSubmit="return validate_form2 ( );">
<input type="text" name="propiedad" value="<?php print $propiedad;?>">
<p class="bookingway">
<input name="bookingway" type="radio" value="instant">Instant booking (I have read terms and conditions).<br>
<input name="bookingway" type="radio" value="enquirer">Send enquirer or book by email.
</p>
<p align="center"><input class="boton" type="submit" name="enviar" value="Send"> </p>
</form>
</div>


When I choose one and click on the submitbutton I am taking to a controlpage wich checks in php if one of the buttons where checked, if none are checked one should be told in php to check one of them, but if one of them were checked one should be redirected to another page depending on button choosen, however it does not work. I chek one of the buttons and get the errormessage saying me to please choose one of them...
This is the code on that page:
<?php 
$propiedad = @mysql_real_escape_string($_POST['propiedad']);
$bookingway = @mysql_real_escape_string($_POST['bookingway']);
$instant = @mysql_real_escape_string($_POST['instant']);
$enquirer = @mysql_real_escape_string($_POST['enquirer']);
if ($_POST['enviar']) {
if (empty($bookingway)) {
echo "Please choose instant booking or send enquirer";
}
else{
if ($bookingway=="instant"){
header ("Location: bookingform.php");
}
if ($bookingway=="enquirer"){
header ("Location: bookingform.php");
}
}//else
}//if enviar

?>


Any help please,
thanks

helenp

1:41 pm on Nov 24, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Lol, it was do to not taking away the mysql call, as I always use those as normally I always work with mysql, it works now.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month